patrickfrey / mewa

Compiler-compiler for writing compiler frontends with Lua
https://github.com/patrickfrey/mewa
MIT License
23 stars 2 forks source link

Sometimes no conflicts reported in grammar #1

Closed patrickfrey closed 2 years ago

patrickfrey commented 3 years ago

In some cases, conflicts in the language grammar are silently ignored. I suspect that it has to do with the prioritization of productions that causes the selection of one path over the other. Probably the prioritization of rules is wrong and an operator precedence implementation like in Bison/Yacc should be implemented.

patrickfrey commented 3 years ago

Example (example language1):

printComplex<double>( 1.3, 2 );

is parsed as (printComplex < double) > ( 1.3, 2 ) conflicts with printComplex as generic reference calling ( 1.3, 2 )

patrickfrey commented 3 years ago

The conflict detection has been strengthened a little bit. I think the problems can be handled now. I don't see it as an urgent issue. I do not consider operator precedence definition as a better solution either.

patrickfrey commented 2 years ago

I closed this issue because it became obvious to me, that this issue is a problem of all parser generators, solving conflicts with some sort of precedence rules.

I saw some "working" grammars, that are obviously hiding parts of the syntax tree. My solution of assigning priorities to productions is not better or worse in this regard. I consider it more readable.