lark/examples
Erez Shinan ac0d49e7ab Added %declare 2018-05-27 00:04:11 +03:00
..
standalone Standalone generator working again. Updated examples 2018-03-10 12:28:35 +02:00
README.md Breaking backwards compatibility: 2018-05-05 17:03:52 +03:00
__init__.py Added examples (calc, json) 2017-02-05 13:40:19 +02:00
calc.py Earley now uses dynamic lexer by default. Bump to version 0.3.0 2017-08-04 16:05:40 +03:00
conf_earley.py Breaking backwards compatibility: 2018-05-05 17:03:52 +03:00
conf_lalr.py Breaking backwards compatibility: 2018-05-05 17:03:52 +03:00
error_reporting_lalr.py Added example for error reporting with LALR 2018-04-18 12:37:57 +03:00
fruitflies.png Improved Readme 2017-11-02 13:47:05 +02:00
fruitflies.py Improved Readme 2017-11-02 13:47:05 +02:00
indented_tree.py Added %declare 2018-05-27 00:04:11 +03:00
json_parser.py Example JSON parser is now LALR 2018-01-02 09:58:19 +02:00
python2.g Small fix in Python grammars (misread tuples, issue #68) 2018-01-21 16:10:26 +02:00
python3.g Small fix in Python grammars (misread tuples, issue #68) 2018-01-21 16:10:26 +02:00
python_parser.py Earley working too 2018-05-05 13:26:28 +03:00
reconstruct_json.py Earley now uses dynamic lexer by default. Bump to version 0.3.0 2017-08-04 16:05:40 +03:00
turtle_dsl.py Earley now uses dynamic lexer by default. Bump to version 0.3.0 2017-08-04 16:05:40 +03:00

README.md

Examples for Lark

Beginners

  • calc.py - A simple example of a REPL calculator
  • json_parser.py - A simple JSON parser (comes with a tutorial, see docs)
  • indented_tree.py - A demonstration of parsing indentation ("whitespace significant" language)
  • fruitflies.py - A demonstration of ambiguity
  • turtle_dsl.py - Implements a LOGO-like toy language for Python's turtle, with interpreter.

Advanced

  • error_reporting_lalr.py - A demonstration of example-driven error reporting with the LALR parser
  • python_parser.py - A fully-working Python 2 & 3 parser (but not production ready yet!)
  • conf_lalr.py - Demonstrates the power of LALR's contextual lexer on a toy configuration language
  • conf_earley.py - Demonstrates the power of Earley's dynamic lexer on a toy configuration language
  • reconstruct_json.py - Demonstrates the experimental text-reconstruction feature