cpsc411 / cpsc411-book

The WIP book for CPSC 411
Other
59 stars 7 forks source link

Ambiguity in Paren-x64 syntax due to non-terminal overlap #109

Open wilbowma opened 1 year ago

wilbowma commented 1 year ago

https://piazza.com/class/lcquw2vc2cs73i/post/173

In Paren-x64 v2:

Conceptually, triv represents operands that trivially compute to values, while loc represents operands that are physical locations. This conceptual distinction makes sense.

However, using these two non-terminals to define the statement results in this annoying, unintuitive overlap.

It's partially an artifact of trying to encode some of the restrictions from x64 syntactically, but the design of the language could probably be improved.

The situation gets worse in v6, when there's opand which also has some overlap: https://www.students.cs.ubc.ca/~cs-411/2022w2/chp-return_book_top.html#%28tech._paren._x64._v6%29