EBNF Colon and Semicolon usage?

1.8k Views Asked by At

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?

1

There are 1 best solutions below

0
On

; and : are simply terminals, just like id, char and integer. So your code could be something like this:

x : char ; y : integer ; z : char