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