ソースを参照

Docs: Added section on debugging

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.3
Erez Sh 3年前
コミット
57b753cd19
1個のファイルの変更15行の追加1行の削除
  1. +15
    -1
      docs/how_to_use.md

+ 15
- 1
docs/how_to_use.md ファイルの表示

@@ -28,7 +28,21 @@ Use the [Cheatsheet (PDF)](https://lark-parser.readthedocs.io/en/latest/_static/

Use the reference pages for more in-depth explanations. (links in the [main page](/index)]

## LALR usage
## Debug

Grammars may contain non-obvious bugs, usually caused by rules or terminals interfering with each other in subtle ways.

When trying to debug a misbehaving grammar, the following methodology is recommended:

1. Create a copy of the grammar, so you can change the parser/grammar without any worries
2. Find the minimal input that creates the error
3. Slowly remove rules from the grammar, while making sure the error still occurs.

Usually, by the time you get to a minimal grammar, the problem becomes clear.

But if it doesn't, feel free to ask us on gitter, or even open an issue. Post a reproducing code, with the minimal grammar and input, and we'll do our best to help.

### LALR

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 the `logger` beforehand. For example:



読み込み中…
キャンセル
保存