Browse Source

Instructions how to get Shift/Reduce messages printed (Issue #258)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.66
Jan Rydzewski 6 years ago
committed by GitHub
parent
commit
fef774f78f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      docs/how_to_use.md

+ 15
- 0
docs/how_to_use.md View File

@@ -52,3 +52,18 @@ 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:

```
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