decaf icon indicating copy to clipboard operation
decaf copied to clipboard

Fix non-associativity of non-eq comparison ops in LL1 grammar

Open zx1239856 opened this issue 5 years ago • 1 comments

Non-equal comparison operators such as <, >, ge, le come without associativity, yet current LL(1) grammar treats them as left associative, which can bring about erroneous parsing output when handling a < b < c (this form should have triggered a syntax error)

zx1239856 avatar Oct 24 '19 19:10 zx1239856

This patch only fixes PA1B.

Although PA1A specifies that '<=' is nonassoc, we can still write a<b<c and the parser is happy.

Maybe we just accept that, and let the subsequent semantic analysis do the job?

Hoblovski avatar Jul 20 '20 11:07 Hoblovski