Updated How to use Lark (markdown)

Erez Shinan 2017-10-31 21:16:19 +02:00
parent 9dd6e3db2d
commit 4c58d05f8c
1 changed files with 7 additions and 5 deletions

@ -25,7 +25,7 @@ Here is some mock usage of them. You can see a real example in the [[examples]]
```python ```python
from lark import Lark, Transformer from lark import Lark, Transformer
parser = Lark("""start: rules and more rules gramamr = """start: rules and more rules
rule1: other rules AND TOKENS rule1: other rules AND TOKENS
| rule1 "+" rule2 -> add | rule1 "+" rule2 -> add
@ -35,7 +35,9 @@ parser = Lark("""start: rules and more rules
TOKEN1: "a literal" TOKEN1: "a literal"
TOKEN2: TOKEN1 "and literals" TOKEN2: TOKEN1 "and literals"
""", start="ebnf") """
parser = Lark(grammar)
tree = parser.parse("some input string") tree = parser.parse("some input string")