https://github.com/brunorb/firstfollow
Compute first and follow sets for context-free grammars
https://github.com/brunorb/firstfollow
compilers first-set follow-set
Last synced: 3 months ago
JSON representation
Compute first and follow sets for context-free grammars
- Host: GitHub
- URL: https://github.com/brunorb/firstfollow
- Owner: BrunoRB
- License: mit
- Created: 2017-07-19T16:29:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-24T00:04:34.000Z (about 7 years ago)
- Last Synced: 2025-02-05T09:38:19.308Z (3 months ago)
- Topics: compilers, first-set, follow-set
- Language: JavaScript
- Homepage: https://brunorb.github.io/firstFollow/
- Size: 18.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# firstFollow
Simples javascript script that computes FIRST and FOLLOW sets for context-free grammars.
## Grammar format
- Check https://brunorb.github.io/firstFollow#rules
- [test/grammar.js](test/grammar.js) contains some examples
- grammars copied from compilers books like the Dragon Book should work just fine## Installing / Running
Try the live demo: https://brunorb.github.io/firstFollow/
or
`npm install firstfollow`
then for node:
var myGrammar = 'A -> b w';
var firstFollow = require('firstfollow');
var data = firstFollow(myGrammar);
var computedFirstSet = data.firstSet;
var computedFollowSet = data.followSet;for the browser:
<script>`
<script>
var myGrammar = 'A -> b w';
var data = firstFollow(myGrammar);
var computedFirstSet = data.firstSet;
var computedFollowSet = data.followSet;
## License
[The MIT License](LICENSE)