Skip to main content

Context-free grammars and parsing

Project description

cfgrammar : Context-free grammars, parsing and semantic

Table of Contents

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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cfgrammar-0.1.0.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cfgrammar-0.1.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file cfgrammar-0.1.0.tar.gz.

File metadata

  • Download URL: cfgrammar-0.1.0.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cfgrammar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f931759d2eae30e21c438c4732207cc5bfcc5efa9e891974b0c4017a60f866ae
MD5 cfae0e30d5ed96249fe235e0e4220cf7
BLAKE2b-256 7aad95f3a21d0890434818d9270d158cd52ce1b5528711ce66f6b4a6d8488040

See more details on using hashes here.

File details

Details for the file cfgrammar-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cfgrammar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cfgrammar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b624be9c6025ab6c0bc33cad0950063b89a4452baf4e68c53810b84eab71026
MD5 fd137df594b0e2b5df306a7fdb881e8b
BLAKE2b-256 7648cb022dc747f6e5875b209270e9bc3e39a9ccf6f20994a5e95e005c29ce9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page