summaryrefslogtreecommitdiffstats
path: root/code/simpleSableCCCalulator/README.md
diff options
context:
space:
mode:
authorAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-10-25 16:57:36 +0100
committerAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-10-25 16:57:36 +0100
commit69b0ad07bac30beca1397ff187468e7597203c44 (patch)
treef125c988f73e2f16bef2a1f145994bc827b0d418 /code/simpleSableCCCalulator/README.md
parent74c5732bded6695eed3aabf125a888fbdf206a40 (diff)
parentaa3a6929584eaa63cafb73353a62effd75d4dd8c (diff)
downloadesotericFORTRAN-69b0ad07bac30beca1397ff187468e7597203c44.tar.gz
esotericFORTRAN-69b0ad07bac30beca1397ff187468e7597203c44.zip
Merge branch 'main' of https://github.com/AlfieEagleton/EsotericProject
Diffstat (limited to 'code/simpleSableCCCalulator/README.md')
-rw-r--r--code/simpleSableCCCalulator/README.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/code/simpleSableCCCalulator/README.md b/code/simpleSableCCCalulator/README.md
new file mode 100644
index 0000000..4878685
--- /dev/null
+++ b/code/simpleSableCCCalulator/README.md
@@ -0,0 +1,22 @@
+# 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`
+
+I setup a makefil that can be used. First make sure that sablecc is extracted in the directory below `EsotericProject` and just run `make`.
+
+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`
+
+
+