Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lunarwhite/cminus-lexer-parser
Build a simply lexer and parser for C minus (subset of C), using Java.
https://github.com/lunarwhite/cminus-lexer-parser
cminus compiler lexer parser
Last synced: about 16 hours ago
JSON representation
Build a simply lexer and parser for C minus (subset of C), using Java.
- Host: GitHub
- URL: https://github.com/lunarwhite/cminus-lexer-parser
- Owner: lunarwhite
- License: mit
- Created: 2022-05-18T13:44:02.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-14T15:59:25.000Z (11 months ago)
- Last Synced: 2023-12-14T16:55:55.879Z (11 months ago)
- Topics: cminus, compiler, lexer, parser
- Language: Java
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cminus-lexer-parser
Build a simply lexer and parser for C minus (subset of C), using Java.
Explore more details in this [blog post](https://lunarwhite.notion.site/Tiny-Lexer-and-Parser-for-CMinus-f5033869faa9425eab94cf8cf2539a92).
## Structure
- Lexer:
- Input a C source file to be syntactically analyzed, output the token sequence after the lexical analysis process, and return it with Java's built-in data structure ArrayList to provide a data source for subsequent lexical analysis.
- Parser:
- The token sequence obtained from the lexical analysis of a program in the previous experiment is input, and the move-in statute sequence from the LR(1) analysis in the bottom-up syntax analysis is output.
- The sequence also shows the contents of the stack and contains error handling and hints. The program can automatically construct an LR(1) analysis table by entering the grammar.## Todo
- Performance improvement. Too many switch-cases, too many nested if-else.
- Complete unit tests to improve test coverage.
- Simply GUI to improve user ease of use.## Reference
- [Let's Build a Compiler, by Jack Crenshaw](https://compilers.iecc.com/crenshaw/)
- [The LEMON Parser Generator](https://www.hwaci.com/sw/lemon/)