diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-10-18 16:40:56 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-10-18 16:40:56 +0100 |
commit | e09b0bb865bbb0087c46b4acd90b759f14dfa824 (patch) | |
tree | 824f93a769d5ae3b38b4f6b3597347b78478e69c /code/simpleSableCCCalulator/README.md | |
parent | 3c3706a8957f27d7bcb553eff6ded1c6dc76fa24 (diff) | |
download | esotericFORTRAN-e09b0bb865bbb0087c46b4acd90b759f14dfa824.tar.gz esotericFORTRAN-e09b0bb865bbb0087c46b4acd90b759f14dfa824.zip |
added sableCC calculator
Diffstat (limited to 'code/simpleSableCCCalulator/README.md')
-rw-r--r-- | code/simpleSableCCCalulator/README.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/code/simpleSableCCCalulator/README.md b/code/simpleSableCCCalulator/README.md new file mode 100644 index 0000000..4c75421 --- /dev/null +++ b/code/simpleSableCCCalulator/README.md @@ -0,0 +1,20 @@ +# simpleSableCCCalculator + +sableCC is a too used to parse .grammar files (containing a BNF, and lexer information) +into a lexer and parser. We can do a depth first traversal of the produced abstract syntax tree +to parse in the correct order. This is in the file `Translation.java`. + +You produce a lexer and parser by running the sablecc .jar file you can download [here](http://downloads.sourceforge.net/sablecc/sablecc-3.7.zip). Then run it with the first argument as the grammar file: + +`java -jar sablecc-3.7/lib/sablecc.jar sableCCCalculator.grammar` + +(changing the paths as appropriate). The produced java files are not included in git since they're unnessicary. We compile the compiler, program stack and translator: + +`javac sableCCCalculator/*.java` + +Then we can run the program. For now it only works by reading files. There are some example maths questions in the examples folder: + +`java sableCCCalculator.Compiler examples/maths.txt` + + + |