An open API service indexing awesome lists of open source software.

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

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)