diff --git a/examples/calc.py b/examples/calc.py index c9da74d..6e7600e 100644 --- a/examples/calc.py +++ b/examples/calc.py @@ -59,7 +59,6 @@ def main(): print(calc(s)) def test(): - # print calc("a=(1+2)") print(calc("a = 1+2")) print(calc("1+a*-3")) diff --git a/examples/conf.py b/examples/conf.py index f9cc84a..81a2fd0 100644 --- a/examples/conf.py +++ b/examples/conf.py @@ -3,7 +3,7 @@ # # The tokens NAME and VALUE match the same input. A regular lexer would arbitrarily # choose one over the other, which would lead to a (confusing) parse error. -# However, due to the unambiguous structure of the grammar, the LALR(1) algorithm knows +# However, due to the unambiguous structure of the grammar, the LALR(1) algorithm knows # which one of them to expect at each point during the parse. # The lexer then only matches the tokens that the parser expects. # The result is a correct parse, something that is impossible with a regular lexer. diff --git a/examples/json_parser.py b/examples/json_parser.py index b29e7ab..7356152 100644 --- a/examples/json_parser.py +++ b/examples/json_parser.py @@ -2,6 +2,7 @@ # This example shows how to write a basic JSON parser # # The code is short and clear, but has good performance. +# For an explanation, check out the JSON parser tutorial at /docs/json_tutorial.md # import sys diff --git a/examples/reconstruct_json.py b/examples/reconstruct_json.py index 6b1ba45..1a8df4e 100644 --- a/examples/reconstruct_json.py +++ b/examples/reconstruct_json.py @@ -1,3 +1,10 @@ +# +# This example demonstrates an experimental feature: Text reconstruction +# The Reconstructor takes a parse tree (already filtered from punctuation, of course), +# and reconstructs it into correct text, that can be parsed correctly. +# It can be useful for creating "hooks" to alter data before handing it to other parsers. You can also use it to generate samples from scratch. +# + import json from .json_parser import json_grammar