lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



28.10.2013 2:06  "Jason Nielsen" <drjdnielsen@gmail.com>
>
> I've been looking at the EBNF in the manual and I'm a bit confused by the following two rules:
>
> var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name
>
> prefixexp ::= var | functioncall | ‘(’ exp ‘)’
>
> if you expand this out you get var on the right hand side of the var rule definition.  I'm not a CS guru so perhaps I'm misunderstanding EBNF notation.
>
> Thanks,
> Jason

I'm not a CS guru either, but my humble guess is that the var on the right hand side means any another string matching var definition, not the var on the left side.

An example: 'x.foo' is var on the left side, and on the right side it matches (another) var 'x' followed by a dot and Name 'foo'.

So there is nothing bad in the definitions being recursive.

Peter M