Kaynağa Gözat

Docs: Added section on debugging

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.3
Erez Sh 3 yıl önce
ebeveyn
işleme
57b753cd19
1 değiştirilmiş dosya ile 15 ekleme ve 1 silme
  1. +15
    -1
      docs/how_to_use.md

+ 15
- 1
docs/how_to_use.md Dosyayı Görüntüle

@@ -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:



Yükleniyor…
İptal
Kaydet