Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Project ideas: C program processing
1. Project ideas: C program processing
2. Problem
Beginning students learning the C programming language could use help with the following.
identifying errors in a meaningful manner
avoiding bad usage of the language
using a correct and consistent style
using printf and scanf correctly
3. Solution
Use a collection of regular expressions to do pattern matching for certain features of the program and then create output that can be transformed into something meaningful.
4. Data
The data to be analyzed for test is a large collection of programs submitted by students.
The real time data will eventually be programs that students are developing for class requirements.
5. Languages
The languages that might be be best used for these projects include the following.
Python : off-line static processing
PHP: server-side processing
JavaScript: client-side processing
6. Style
Checking style usage, say for braces, could be done as follows.
Pass 1: determine the style being used
Pass 2: pretty print the program using that style
Check: Use LCS (Longest Common Subsequence) algorithm, also called the MED (Minimum Edit Distance) algorithm, to determine deviations from the used style and the desired style (i.e., style errors).
Provide diagnostics in a meaningful manner.
7. printf and scanf
Checking the usage of printf and scanf can be done as follows.
Use regular expressions to determine declared variables and types.
Use regular expressions to determine printf and scanf statements.
Use regular expressions to separate the parts of the printf and scanf statements.
Check validity of the printf and scanf statements.
Provide diagnostics in a meaningful manner.
8. Language usage
Use regular expressions to do simple parsing of the language.
Look for the usage of the equal sign in other than as an assignment operator.
Provide diagnostics in a meaningful manner.
if (x = 2) {
// then part
}
else {
// else part
}
The assignment statement in the condition always succeeds. The else part will never be executed.
9. End of page
10. Acronyms and/or initialisms for this page
2 acronyms omitted (login required)