Metadata-Version: 2.2
Name: cfgrammar
Version: 0.1.0
Summary: Context-free grammars and parsing
Author-email: Bruno Bogaert <Bruno.Bogaert@univ-lille.fr>
Project-URL: Homepage, https://gitlab.univ-lille.fr/bruno.bogaert/cfgrammar
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.TXT

# cfgrammar : Context-free grammars, parsing and semantic #

## Table of Contents

- [Main Features](#main-features)
- [Example](#example)

## Main features

* Grammar properties
  * accessible and productive rules / variables
  * ε-productive rules / variables
  * reduced grammar
  * "First" and "Follow" sets
* LL1 parsing
  * computes and displays LL(1) table
  * constructs parser
* LR parsing
  * computes and displays LR(0) automaton
  * constructs LR(0), SLR(1), LALR(1) tables and parsers
* Semantic
  * parsing with semantic actions
* Abstract Syntax Tree
  * predefined semantic classes to produce AST
    * Graphviz / dot output 
    * Latex + Tikz output
  
## Example

```python
from cfgrammar import Grammar

g = Grammar.from_string('S -> ( S ) S | a')

print(g)
print('productives variables : ', g.productive.vars)
print('Follow sets : ', g.follow)
```
