orangeduck/mpc

Add support for semantic action for language parser

Opened this issue · 1 comments

I was trying to do inline type inference rather than to generate a parse tree then traverse it after PEG passes, this way we could avoid some potential backtracking issue by stopping ahead and hence sped up (or terminate) the parsing process.

I know Clang does parse tree scan too but they clearly had more information than what mpc currently have to deduce a sound combinations.

If you build up your own AST data type as you go using the combinator approach (rather than the grammar approach) you can insert as much functionality as you like in-between parsing. Yes it is a bit less user friendly than the grammar definition but it is the only sane way to do this sort of thing while still making use of mpc.