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.0.9.3.tar.gz (37.0 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.0.9.3-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cfgrammar-0.0.9.3.tar.gz
Algorithm Hash digest
SHA256 a7ac25672a5d35d9c3eccd3df1415539bd9e4ac35c9b748672d2b54ff8356e0a
MD5 6fb1c9f6b4d47675d2f6227a4a6cbb2f
BLAKE2b-256 0ce16c97b8c7dca90de7899c9e4ae9db02e446d03ed160154b917f5f5c98a884

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cfgrammar-0.0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 40.2 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.0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 113d250e12c73b79210b8f8098cf39d66b36ca5b6c6591c46d1112fa29712547
MD5 83f5f3a5eab6fb76f67d7ff557ea8411
BLAKE2b-256 f1cb1eeb768120b878931e0fd797aa6c32659bac1523a4795fc2300c36ab3502

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