|
Last change
on this file since 0957f62 was 2cb10170, checked in by Alvin Zhang <alvin.zhang@…>, 5 months ago |
|
stitched modules proposal
|
-
Property mode
set to
100644
|
|
File size:
982 bytes
|
| Line | |
|---|
| 1 | ## Generating the parser code *(already done, in parser/)*
|
|---|
| 2 |
|
|---|
| 3 | Using ANTLR4 (v4.13.2) to parse grammars. See https://github.com/antlr/antlr4/blob/master/doc/getting-started.md for details. Run `pip install antlr4-tools` to get `antlr4` and `anltr4-parse` executables. Example command: `antlr4-parse parser/CMOD.g4 compilationUnit -gui testing/noImports.cmod`
|
|---|
| 4 |
|
|---|
| 5 | CMOD.g4 grammar inspired by https://github.com/antlr/grammars-v4/blob/master/c/C.g4 (though heavily edited afterwards). Ran `antlr4 -Dlanguage=Python3 parser/CMOD.g4` to generate parser code (you can add `-visitor -listener` flags for extra capabilities).
|
|---|
| 6 |
|
|---|
| 7 | ## Running the code
|
|---|
| 8 |
|
|---|
| 9 | Adapted the steps from https://github.com/antlr/antlr4/blob/master/doc/python-target.md to generate output. Run `pip install -r requirements.txt` to get needed libraries, then `python3 Driver.py -r testing testing/noImports.cmod` to run on example code.
|
|---|
| 10 |
|
|---|
| 11 | ## Documentation
|
|---|
| 12 |
|
|---|
| 13 | The concepts behind this prototype are discussed in `stitched_modules.md`
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.