F
Fons
Guest
I am working on a compiler which generates VHDL and uses precedence
and associativity to generate the least parenthesis possible.
According to the LRM, "operators with the same precedence level are
associated with their
operands in textual order, from left to right."
More specifically, according to VHDL for Engineers (http://
books.google.com/books?id=7GKpXrMuZTIC&dq), the following two
expressions are equivalent:
a and not b or not a and b
((a and (not b)) or (not a)) and b
However, while Quartus II and Modelsim accept the second one, they
raise a parser error when trying to compile the first one.
If the "or" is changed with "and" the expression doesn't cause any
problems:
a and not b and not a and b
Can anyone confirm wether is a bug or the book is wrong?
Thanks.
and associativity to generate the least parenthesis possible.
According to the LRM, "operators with the same precedence level are
associated with their
operands in textual order, from left to right."
More specifically, according to VHDL for Engineers (http://
books.google.com/books?id=7GKpXrMuZTIC&dq), the following two
expressions are equivalent:
a and not b or not a and b
((a and (not b)) or (not a)) and b
However, while Quartus II and Modelsim accept the second one, they
raise a parser error when trying to compile the first one.
If the "or" is changed with "and" the expression doesn't cause any
problems:
a and not b and not a and b
Can anyone confirm wether is a bug or the book is wrong?
Thanks.