Browse Source

Merge pull request #266 from SupraSummus/patch-1

Instructions how to get Shift/Reduce messages printed (Issue #258)
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.66
Erez Shinan 6 years ago
committed by GitHub
parent
commit
c436940d81
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      docs/how_to_use.md

+ 16
- 0
docs/how_to_use.md View File

@@ -52,3 +52,19 @@ class MyTransformer(Transformer):
new_tree = MyTransformer().transform(tree)
```

## LALR usage

By default Lark silently resolves Shift/Reduce conflicts as Shift. To enable warnings pass `debug=True`. To get the messages printed you have to configure `logging` framework beforehand. For example:

```python
from lark import Lark
import logging
logging.basicConfig(level=logging.DEBUG)

collision_grammar = '''
start: as as
as: a*
a: 'a'
'''
p = Lark(collision_grammar, parser='lalr', debug=True)
```

Loading…
Cancel
Save