Closed ptal closed 3 years ago
Somewhat relevant to the discussion, if we use sum variant in semantic action, for example:
expr = addition > Addition
/ substraction > Substraction
it becomes impossible to guess the type of the rule. We can extend the ->
to specify any rust type and to be applied on rule (for convenience), the previous example becomes:
expr -> RustTy
= addition > Addition
/ substraction > Substraction
with RustTy
the rust type.
Postponed because we will match on Rust tokens with another technique. This is still interesting for general pattern matching so I do not close this issue for now but, since we are in a typed context (which is different from OMeta), we might consider another approach later.
Triage: abandon this feature. We will focus on #93 instead.
Extend the parser with "tree-shape" atoms. This will allow to provide pattern matching on enum type and for example, to directly work with the Rust compiler Lexer. Several notes:
We leave the type checking of the branches of the choice combinator (e1 / e2, T1 must equals T2) to the Rust compiler. It closes #73.Finally, we chose to check the branches.mod::BinOp(mod2::Plus)
. It closes #54.BinOp
formod::BinOp
so we can distinguish function/rules VS. tree-data.Some references on this topic of tree-pattern matching with PEG: