Lua - Syntax-DiagrammsPDF Deutsch


You are here:LuaSyntax-Diagramms


The Lua-Syntax is defined as follows:

chunk -> { stat [ ‘;’ ] } 
block -> chunk
stat -> varlist1 ‘=’ explist1
            | functioncall
            | do block end
            | while exp do block end
            | repeat block until exp
            | if exp then block { elseif exp then block } [ else block ] end
            | return [ explist1 ]
            | break
            | for Name ‘=’ exp ‘,’ exp [ ‘,’ exp ] do block end
            | for Name { ‘,’ Name } in explist1 do block end
            | function funcname funcbody
            | local function Name funcbody
            | local namelist [ init ]
funcname -> Name { ‘.’ Name } [ ‘:’ Name ]
varlist1 -> var { ‘,’ var } 
var -> Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name
namelist -> Name { ‘,’ Name } 
init -> ‘=’ explist1
explist1 -> { exp ‘,’ } exp
exp -> nil | false | true | Number | Literal
            | function | prefixexp | tableconstructor | exp binop exp | unop exp
prefixexp -> var | functioncall | ‘(’ exp ‘)’
functioncall -> prefixexp args | prefixexp ‘:’ Name args
args -> ‘(’ [ explist1 ] ‘)’ | tableconstructor | Literal
function -> function funcbody
funcbody -> ‘(’ [ parlist1 ] ‘)’ block end
parlist1 -> Name { ‘,’ Name } [ ‘,’ ‘...’ ] | ‘...’
tableconstructor -> ‘{’ [ fieldlist ] ‘}’
fieldlist -> field { fieldsep field } [ fieldsep ]
field -> ‘[’ exp ‘]’ ‘=’ exp | name ‘=’ exp | exp
fieldsep -> ‘,’ | ‘;’
binop -> ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘^’ | ‘..’
            | ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’
            | and | or
unop -> ‘-’ | not

I tried to build this Syntax of Lua int Rail-Diagramms . The result can be found in the PDF-Dokument.

Please correct me, if there are errors. It's more ore less a beta-version.