11. Полный синтаксис Lua
chunk ::= {stat [`;']}
block ::= chunk
stat ::= varlist1 `=' explist1
| functioncall
| do block end
| while exp1 do block end
| repeat block until exp1
| if exp1 then block {elseif
exp1 then block} [else block] end
| return [explist1]
| break
| for `name' `=' exp1 `,'
exp1 [`,' exp1] do block end
| for `name' `,' `name'
in exp1 do block end
| function funcname `(' [parlist1] `)'
block end
| local declist [init] funcname ::= `name'
| `name' `.' `name' | `name'
`:' `name'
varlist1 ::= var {`,' var}
var ::= `name' | varorfunc `[' exp1 `]'
| varorfunc `.' `name'
varorfunc ::= var | functioncall
declist ::= `name' {`,' `name'}
init ::= `=' explist1
explist1 ::= {exp1 `,'} exp
exp1 ::= exp
exp ::= nil | `number' | `literal' | var
| function | upvalue
| functioncall | tableconstructor
| `(' exp `)' | exp binop exp | unop exp
functioncall ::= varorfunc args | varorfunc `:' `name' args
args ::= `(' [explist1] `)' | tableconstructor
| `literal'
function ::= function `(' [parlist1] `)'
block end
parlist1 ::= `...' | `name' {`,'
`name'} [`,' `...']
upvalue ::= `%' `name'
tableconstructor ::= `{' fieldlist `}'
fieldlist ::= lfieldlist | ffieldlist | lfieldlist `;'
ffieldlist | ffieldlist `;' lfieldlist
lfieldlist ::= [lfieldlist1]
ffieldlist ::= [ffieldlist1]
lfieldlist1 ::= exp {`,' exp} [`,']
ffieldlist1 ::= ffield {`,' ffield} [`,']
ffield ::= `[' exp `]' `=' exp
| `name' `=' exp
binop ::= `+' | `-' | `*' | `/'
| `\^{ ' | `..'
| `<' | `<=' | `>'
| `>=' | `==' | `\ { '=}
| and | or}
unop ::= `-' | not