lua-users home
lua-l archive

Lua grammar question

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


The Lua grammar contains these three lines to describe the syntax for function calls:
	functioncall = p args | p ':' Name args
	p = var | functioncall | '(' exp ')'
	var = Name | p '[' exp ']' | p '.' Name
That is left recursive in strange ways, and thus Greek to me. Based on my understanding of the language, I've tried to rewrite it to something which is easier to understand for me. Does this match the grammar?
	functioncall =
		( Name | '(' exp ')' )
		( args | '.' Name | ':' Name | '[' exp ']' )*
		args
Regards,
Asger Ottar Alstrup

AltStyle によって変換されたページ (->オリジナル) /