Context-Free Grammars? What about arrays?

%u wfunction at hotmail.com
Wed Feb 16 01:14:12 PST 2011


> Yes, they just happen to look identical: but that's the crux: How it
"looks" is the *only* thing that parser/grammar are concerned with.

> If it worked like this:
> <Array Decl> ::= <Type> '[' <Ident> ']' <Ident> ';'
> <Assoc Array Decl> ::= <Type> '[' <Ident> ']' <Ident> ';'
> ...*Then* it would no longer be context-free because the parser
would have to rely on the semantics of 'U' to determine how to parse
it.

Ahh that makes sense. Thank you for the great explanation! :)


More information about the Digitalmars-d-learn mailing list