Skip to content

Watercycle/clite-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLite File Verifier

A simple executable program that takes a CLite source file as its argument and will then perform lexical, syntactic, and (basic) type analysis on the file. Upon failure, a failure message will be outputted. Upon success, intermediate tree structures will be sent to the 'output' folder. These trees represent the underlying transformations that take place while parsing source files.

Dependencies

Since this program uses Clojure, make sure you have the latest Java Runtime from Oracle

Instaparse depends on Graphviz to draw out the parse trees. It may be installed from their website

Note: Windows users, make sure to you create a new entry for the graphviz bin folder in your system environment variables path.

Usage

You may run the distributed version with the following command.

java -jar cverify.jar SOURCE_FILE

Where SOURCE_FILE is the qualified file directory and name to be 'verified'.

Demonstration

Suppose relative to the executable we have a folder named 'tests', which contains the following file.

comprehensive_test.txt

int main()
{
    int a,b,c,d;
    float e,f,g,h;
    int i[3];
    
    a =  + ;
}

We may verify the file as follows:

java -jar cverify.jar tests/comprehensive_test.txt

Which produces the following error output:

alt text

Had the file been properly formed, we would have been given its parse trees in the 'output' folder, which would looking something like the following:

alt text

Building

To build the program, simply navigate to the project directory and run the following:

lein uberjar

(http://leiningen.org/)

A standalone jar file will be available in the 'target' folder.

About

A basic parser for a watered down version of C.

Resources

License

Stars

Watchers

Forks

Packages

No packages published