From fef774f78fcb3516fff470a910f4634f29832450 Mon Sep 17 00:00:00 2001 From: Jan Rydzewski Date: Fri, 26 Oct 2018 14:08:06 +0200 Subject: [PATCH] Instructions how to get Shift/Reduce messages printed (Issue #258) --- docs/how_to_use.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/how_to_use.md b/docs/how_to_use.md index 95041e4..a76df2d 100644 --- a/docs/how_to_use.md +++ b/docs/how_to_use.md @@ -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) +```