C program checker
Sponsored Links
This presentation is the property of its rightful owner.
1 / 15

C Program Checker PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

C Program Checker. By:Advisor: Mike BurgioDr. Fischbach Chris Addis. Goals. Make a program that detects potential errors in freshman C programs Specifically errors not detected by the gcc compiler. Includes syntax and semantic errors

Download Presentation

C Program Checker

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

C program checker

C Program Checker


Mike BurgioDr. Fischbach

Chris Addis



  • Make a program that detects potential errors in freshman C programs

    • Specifically errors not detected by the gcc compiler.

    • Includes syntax and semantic errors

  • Print out the line numbers where the potential error has occurred.

Syntax errors

Syntax Errors

  • Syntax is a set of rules that define the sequence of symbols that are considered to be correctly structured programs in that language

  • The gcc compiler finds all syntax errors.

In terms of our project

In terms of our project

  • We are looking for errors that do not violate the syntax of the language, but might not be what the programmer intended.

    • Ex. Using scanf statement without an “&”

    • scanf(“%d”, x);

What is printf scanf

What is printf / scanf

Syntax example

Syntax Example

  • A simple control structure

    int x = 2, y = 4;

    if(x = y) {


    } else {

    printf(“Not Same\n!”);


Semantic errors

Semantic Errors

  • Semantics of a program are what the actual statements do and what the expressions mean when the program is executed.

  • Specific examples of semantic errors:

    • Failure to initialize variable

    • Proper type conversion

      • Ex. Truncating a real number unintentionally

Semantic example

Semantic Example

A common while loop

int i;

while(i<5) {

printf(“Hello World”);

i = i + 1;




  • Grammar for C defines what is acceptable code to be read by a compiler

  • In our grammar, we define what is acceptable and unacceptable for specific cases, and skip the rest

  • This is an extendable project, allowing us to add more errors as we progress



  • To make our C Checker, we used JavaCC

  • JavaCC is a parser generator and lexical analyzer that allows us to define our grammar

  • JavaCC analyzes the program as follows:

    • Breaking up each line into tokens

    • Tokens are processed to determine the structure of the program

    • Checks to see if the sequence of tokens matches our correct case, or matches our incorrect case

Our program checks

Our Program checks…

  • Only one equal sign in if statements, for/while loops

  • Scanf/printf statements containing improper ampersand

  • Inconsistent amount of variables and percent codes

  • Truncation from real number to integer

  • Variables being used before being initialized

  • Ensuring the types match with variables

  • Performs a usage analysis at the end of the program and prints any unused variables

  • And more!

What is a gui

What is a GUI

  • GUI is a graphical user interface

  • This allows users to interact with electronic devices with images rather than text commands

  • GUI’s have become very common in modern programming

Our gui


  • In order to make our program easy to use, we implemented a GUI

  • Our program can also run as a text command if the user prefers.

C program checker




  • Login