Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sr1jan/grok-compiler
grokking compilers...
https://github.com/sr1jan/grok-compiler
compiler compiler-construction compiler-design compiler-principles compilers computer-science education educational
Last synced: 8 days ago
JSON representation
grokking compilers...
- Host: GitHub
- URL: https://github.com/sr1jan/grok-compiler
- Owner: sr1jan
- Created: 2021-04-10T01:03:25.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-12T05:31:59.000Z (almost 4 years ago)
- Last Synced: 2024-11-11T11:47:49.268Z (2 months ago)
- Topics: compiler, compiler-construction, compiler-design, compiler-principles, compilers, computer-science, education, educational
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# init(grok-compiler)
while (grok < '100%' || !bored):
continue## Syntax Analysis
- First and Follow ([code](https://github.com/sr1jan/grok-compiler/blob/master/firstnfollow.py))
- Both **First** and **Follow** helps the compiler to optimize the construction of parse/syntax tree inorder to verify syntax correctness
of the input string (code).
- **First** precomputes the correct node of a production rule hence saving the compiler from backtracking to retrieve the node needed to generate the string from the parse tree.
- **Follow** helps when a production rule fails to return the required [terminal value](https://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols). It basically lets the compiler to jump to a different node by applying the ε (epsilon) value and thereby vanishes the non-terminal value to generate the string.### References
- [Compilers by Alex Aiken](https://archive.org/details/academictorrents_e31e54905c7b2669c81fe164de2859be4697013a) (Internet Archive <3)
- Python's regular expression implementation: [re](https://github.com/python/cpython/blob/master/Modules/_sre.c)