An open API service indexing awesome lists of open source software.

https://github.com/djblue/project-3

CSE 340 Project - Part 3
https://github.com/djblue/project-3

Last synced: about 1 month ago
JSON representation

CSE 340 Project - Part 3

Awesome Lists containing this project

README

          

# Simple Compiler

This project contains a lexer implemented using a DFA. The lexer is
contained in 'include/lexer.h'.

## Building

Building the project is simple. The default make target will build the
project. Just run the following command:

make

The resulting executable is __run__, which expects two arguments, an input
file name and an output file name.

## Usage

./run [flag] in out

Where in and out are the input and output files.

## Flags

- The flag '-l' will output the lexer output.
- The flag '-p' will output the parser output.

## Running Tests

Test automation is also provided by way of a make target.

make test

It will rebuild the project, run the internal unit tests, and the
remaining test cases in the 'tc' directory.

## Grammar Rules

Below are the grammar rules for this parser.

:= [type] [id] ( | )+ | ""
:= ("," [id]) ";"
:= "(" * ")" "{" * "}"

:= [type] [id] ([type] [id])*
:= ("," )*

:= | | | | |
:= ("{" * "}" | )
:= "(" ")"

:= [type] ([id] | [id] "=" )+ ";"
:= "if" "else"
:= "while"
:= "return" (";" | ";")
:= [id] "=" ";"
:= [id] "(" ")" ";"

:=
:= | "||"
:= | "&&"
:= | "!"

:=
:= (">" )
:= ("<" )
:= ("!=" )
:= (">=" )
:= ("<=" )
:= ("==" )

:=
:= ("+" )+
:= ("-" )+

:=
:= ("/" )+
:= ("*" )+
:= ("%" )+

:=
:= "-"

:= "(" ")"
:= [type] | [id] | [keyword]
:=