Reputation: 243
I have no idea what a colon means in BNF or EBNF. It's not listed anywhere on the internet. Anyway, my professor decided to assign it in the homework. I think he is confusing it with a semicolon or something. I'm still not even sure what the semicolon means. Here is some context:
Given the following CFG (context free grammar) for declarations:
D -> D ; D
D -> id : T
T -> char
T -> integer
Give an attribute grammar that defines type of an identifier (id stands for identifier).
Anyone think they can help?
Upvotes: 0
Views: 1916
Reputation: 4507
;
and :
are simply terminals, just like id
, char
and integer
. So your code could be something like this:
x : char ; y : integer ; z : char
Upvotes: 1