lark/examples
Erez Shinan 28a8cb1cc7 Improved docs 2018-08-03 16:31:17 +03:00
..
standalone Changing changes from .lrk to .lark 2018-04-14 20:27:39 -04:00
README.md Added custom_lexer to examples/README 2018-07-10 15:01:31 +03:00
__init__.py Added examples (calc, json) 2017-02-05 13:40:19 +02:00
calc.py Improved documentation and code style (minor) 2018-06-27 16:37:41 +03:00
conf_earley.py Improved documentation and code style (minor) 2018-06-27 16:37:41 +03:00
conf_lalr.py Improved documentation and code style (minor) 2018-06-27 16:37:41 +03:00
custom_lexer.py Added custom_lexer to examples/README 2018-07-10 15:01:31 +03:00
error_reporting_lalr.py Fixed examples for error reporting 2018-06-27 17:04:23 +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 option to provide a custom lexer (with example) 2018-07-10 14:52:40 +03:00
json_parser.py Improved documentation and code style (minor) 2018-06-27 16:37:41 +03:00
lark.lark Added %declare to examples/lark.lark 2018-05-27 12:05:00 +03:00
lark_grammar.py Resolved upstream changes to use new file-extension 2018-04-25 14:28:12 -04:00
python2.lark Merge branch 'file-ext-change' of https://github.com/RobRoseKnows/lark into RobRoseKnows-file-ext-change 2018-05-27 11:59:40 +03:00
python3.lark Merge branch 'file-ext-change' of https://github.com/RobRoseKnows/lark into RobRoseKnows-file-ext-change 2018-05-27 11:59:40 +03:00
python_parser.py Merge branch 'file-ext-change' of https://github.com/RobRoseKnows/lark into RobRoseKnows-file-ext-change 2018-05-27 11:59:40 +03:00
qscintilla_json.py Improved docs 2018-08-03 16:31:17 +03:00
reconstruct_json.py Fixed reconstruct 2018-06-27 16:56:07 +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.
  • lark_grammar.py + lark.lark - A reference implementation of the Lark grammar (using LALR(1) + standard lexer)

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
  • custom_lexer.py - Demonstrates using a custom lexer to parse a non-textual stream of data
  • reconstruct_json.py - Demonstrates the experimental text-reconstruction feature