How yonyuk/pylgen works
PyLGEN is a Python-native compiler and interpreter framework, with a pure-Python development interface and Cython-backed implementations. Its principal workflow takes source text through tokenization, grammar-based parsing and AST construction, then semantic analysis and evaluation, producing a result or errors. Separate capabilities include regex-to-automaton tools and interactive visualizations. The README documents the main pipeline; source excerpts additionally show visualization code using parser-building logic. Other internal connections are omitted where the sampled code does not establish them.
Main entry points: lexer Lexer · parser_builder.pyx Parser Builder · parser.pyx Parser Runtime · types.pyx AST
Components 19
Language Processing
- Lexer
pylgen/lexer - Grammar
pylgen/grammar - Parser Builder
pylgen/parser/parser_builder.pyx - Parser Runtime
pylgen/parser/parser.pyx - AST
pylgen/common/types.pyx - Result or Errors
pylgen/common/types.pyx - Parser Modes
pylgen/parser/parser_type.py - Parser Actions
pylgen/parser/bottom_up_parser_actions.py
Core Foundations
- Regex Engine
pylgen/regex/engine.pyx - Finite Automata
pylgen/automaton/automaton.pyx - Core Types
pylgen/common/types.pyx - Token and Error Enums
pylgen/common/enums.py
Analysis
- Semantic Analysis
pylgen/analysis/visitor.pyx - Context Management
pylgen/analysis/context.pyx - Evaluation
pylgen/analysis
Visualization
- Interactive Visualizations
pylgen/visual/__init__.py - Parser Tables
pylgen/visual/table.py
Other components
- Language Author
- Source Text
Connections 21
- Language Author → Lexer: defines tokens
readme.md - Language Author → Grammar: defines grammar
readme.md - Source Text → Lexer: tokenizes
readme.md - Lexer → Parser Runtime: supplies tokens
readme.md - Grammar → Parser Builder: generates parser
readme.md - Parser Builder → Parser Runtime: builds parser
readme.md - Parser Runtime → AST: constructs AST
readme.md - AST → Semantic Analysis: analyzes
readme.md - Semantic Analysis → Context Management: uses context
- Semantic Analysis → Evaluation: evaluates
readme.md - Evaluation → Result or Errors: produces result
readme.md - Regex Engine → Finite Automata: converts to
readme.md - Lexer → Regex Engine: uses regex
readme.md - Interactive Visualizations → AST: visualizes
readme.md - Interactive Visualizations → Finite Automata: visualizes
readme.md - Interactive Visualizations → Parser Tables: renders tables
pylgen/visual/__init__.py - Parser Tables → Parser Builder: calls builder
pylgen/visual/table.py - Parser Runtime → Parser Actions: dispatches actions
- Parser Builder → Parser Modes: selects mode
- Lexer → Token and Error Enums: uses token types
- AST → Core Types: uses core types