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
- Host: GitHub
- URL: https://github.com/djblue/project-3
- Owner: djblue
- Created: 2014-04-09T17:13:51.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-14T18:01:27.000Z (over 11 years ago)
- Last Synced: 2025-01-19T13:37:09.270Z (12 months ago)
- Language: C++
- Size: 859 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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]
:=