lua-users home
lua-l archive

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


Hi,

I'm writing a parser for lua and found some strange rules in the EBNF Syntax available athttp://www.lua.org/manual/5.1/manual.html#8



exp ::=  nil | false | true | Number | String | `...´ | function |
		 prefixexp | tableconstructor | exp binop exp | unop exp

prefixexp ::= var | functioncall | `(´ exp `)´

functioncall ::=  prefixexp args | prefixexp `:´ Name args

args ::=  `(´ [explist] `)´ | tableconstructor | String


Looking at these four rules above the Language allowes functioncalls like:


("Hello")"hello"

or

(nil):Test("hello")


Which are obviously senseless and when I try to execute them the interpreter gives me the following error message:

ambiguous syntax (function call x new statement) near '('

Is this intenden behaviour or is this an error and somebody can provie me a updated EBNF syntax.

Best regards,

Nicolai Mainiero