forked from mrbojangles3/LL-1--Parser
-
Notifications
You must be signed in to change notification settings - Fork 0
walidzaidouh/LL-1--Parser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
#README for CS3240 Project 1 #LL(1) scanner parser # Authors: James McCarty # Logan Blyth # Rob Rayborn C/Java impelmentation of an LL(1) parser of the Tiny language described in "Compiler Construction: Principles and Practice" by Kenneth C. Louden This program requries two inputs: 1. An LL(1) grammar file, i.e. tiny.g 2. A tiny source file to test, i.e. tiny.t To run the project: ./run.sh tiny_file.t input_grammar.g <parsing_table_output_filename.csv> parsing_table_output_filename is an optional parameter for parse table output, if not provided the parse table is saved to parseTable.csv The project runs in two parts: 1. The scanner tokenizes the input source file into symbols. - If errors are enountered, they are dumped to the terminal and the script exits. - If no errors are encountered, the script gives no output. - If the scan was successful, a file named tiny.t.tok will exist in the run directory, where 'tint.t' was the input file name. 2. The parser/generator runs on the tokenized input and grammar file. - It outputs the LL(1) parsing table to the name specified, or to parseTable.csv by default. - If the parse was successful, the message: "Parse completed successfully! No errors detected." will print to the console. - If there are errors in the input grammar, a useful message will be printed to the console. - If there is an error in parsing, the current token, current token's location in the input file, and the parse stack will be dumped to the console. NOTE: The symbol we used for epsilon is the string "EPSILON" To compile files with out run.sh: Type 'make all' To run the scanner and generate tokens on an input file without run.sh: Run ./scanner tiny_file.t Output of the scanner goes to stdout. To run the Parser/Generator without running run.sh: Run java ParserDriver tiny_token_file.tok grammar_file.g parsing_table_output_filename.csv <-v> -v is an optional flag to use verbose mode which prints helpful data (grammar, first set, follow set, etc.) to the terminal. To simply build a parse table without running run.sh: Run java ParserDriver grammar_file.g <parsing_table_output_filename.csv> parsing_table_output_filename is an optional parameter for parse table output, if not provided the parse table is saved to parseTable.csv
About
C impelmentation of an LL(1) parser of the Tiny language described in "Compiler Construction: Principles and Practice" by Kenneth C. Louden
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Java 84.9%
- C 9.8%
- GAP 2.1%
- Shell 1.7%
- Makefile 1.1%
- Terra 0.2%
- Other 0.2%