theta icon indicating copy to clipboard operation
theta copied to clipboard

Merge grammars

Open radl97 opened this issue 4 years ago • 0 comments

Grammars have too much duplicates. Types, declarations, expressions and statements' grammar are mostly the same, as far as I know.

This duplication makes extending grammar and creating new formalisms a pain. (Maybe I can prevent creating the XCFA-Bitvector element of Formalisms X GrammarFeatures)

The problem is that you cannot import an other .g4 grammar file (or reuse generated sources, they will become separate packages).

One solution could be to create a high-level grammar that contains every grammar...

cfa-highlevel: decl* cfa-edge*
cfa-edge: ...
xcfa-highlevel: ...

A visitor base could be created in core subproject, that handles low-level stuff (if the syntax does not change at stmt-level for different formalisms), and for every package the matching (cfa -> cfa-*) grammar elements.

Any thoughts?

radl97 avatar Sep 25 '20 13:09 radl97