JetBrains / Grammar-Kit

Grammar files support & parser/PSI generation for IntelliJ IDEA
Other
713 stars 125 forks source link

Bison features & precedence capability #78

Closed andylamp closed 8 years ago

andylamp commented 8 years ago

I am trying to write a grammar using grammar-kit but your documentation is very very poor and it makes it hard to do (although live view helps).

Now is there anything similar in Grammar-Kit to the %precedence, %left, %expect and other notation like functionality in Bison (or any way to emulate it).

PS: it would really help if there was a manual or a feature list that Grammat-Kit supports when coming from Bison as well as some equivalents examples.

gregsh commented 8 years ago

The underlying generator technologies are way too different.

Bison: LR or GLR with LALR(1) tables Grammar-Kit: PEG (human readable recursive descent) and Pratt expression parsing

Grammar-Kit also almost lacks real lexer specification because IntelliJ platform already uses JFlex for that.

%precedence See HOWTO for expression parsing with precedence.

%left and %right Expression parsing supports "rightAssociative" attribute.

%expect PEG deals with conflicts by means of ordered-choice and predicates.