Subcollections
SET_TYPES = { "bool", "char", "float", "int", "string" }
SET_LITERALS = { <boolean_literal>, <char_literal>, <float_literal>, <int_literal>, <string_literal> }
SET_INSTRUCTIONS = { "label", "break", "continue", "if", "goto", "while", "do", "switch", "return", ";" }
SET_UNARIES = { "&", "*", "~", "+", "-", "!" }
module
module: "module" <identifier> ";" globals.
globals
globals: e.
globals: global globals.
globals: "extern" global globals.
global
global: function.
global: declaration.
function
function: functionheader functionrest.
functionheader
functionheader: modifiers <identifier> ":" paramlist "->" returntype.
functionrest
functionrest: ";".
functionrest: block.
modifiers:
modifiers: e.
modifiers: "start".
paramlist
paramlist: "void".
paramlist: paramblock moreparamblocks.
moreparamblocks
moreparamblocks: e.
moreparamblocks: ";" paramblock moreparamblocks.
paramblock
paramblock: type param moreparams.
moreparams
moreparams: e.
moreparams: "," param moreparams.
param
param: reference <identifier> dimensionblock.
returntype
returntype: type reference dimensionblock.
reference
reference: e.
reference: "*" reference.
dimensionblock
dimensionblock: e.
dimensionblock: "[" "]" dimensionblock.
block
block: "{" code "}".
code
code: e.
code: block code
code: statement code.
statement
statement: "label" <identifier> ";"
statement: ";"
statement: "break" ";"
statement: "continue" ";"
statement: expression ";"
statement: declarationblock ";"
statement: "if" "(" expression ")" block elseblock
statement: "goto" <identifier> ";"
statement: "while" "(" expression ")" "do" block
statement: "do" block "while" "(" expression ")" ";"
statement: "switch" "(" expression ")" "{" switchcases "default" block "}"
statement: "return" returnarg ";".
returnarg
returnarg: "(" expression ")".
returnarg: e.
elseblock
elseblock: e.
elseblock: "else" block.
switchcases
switchcases: e.
switchcases: "case" <int_literal> block swithcases.
declarationblock
declarationblock: type declaration restdeclarations.
restdeclarations
restlocals: e.
restlocals: "," declaration restdeclarations.
declaration
local: reference <identifier> indexblock initializer.
indexblock
indexblock: e.
indexblock: "[" <int_literal> "]" indexblock.
initializer
initializer: e.
initializer: "=" expression.
expression
expression: logicalor restexpression.
restexpression
restexpression: e.
restexpression: "=" logicalor restexpression.
logicalor
logicalor: logicaland restlogicalor.
restlogicalor
restlogicalor: e.
restlogicalor: "||" logicaland restlogicalor.
logicaland
logicaland: bitwiseor restlogicaland.
restlogicaland
restlogicaland: e.
restlogicaland: "&&" bitwiseor restlogicaland.
bitwiseor
bitwiseor: bitwisexor restbitwiseor.
restbitwiseor
restbitwiseor: e.
restbitwiseor: "|" bitwisexor restbitwiseor.
bitwisexor
bitwisexor: bitwiseand restbitwisexor.
restbitwisexor
restbitwisexor: e.
restbitwisexor: "^" bitwiseand restbitwisexor.
bitwiseand
bitwiseand: equality restbitwiseand.
restbitwiseand
restbitwiseand: e.
restbitwiseand: "&" equality restbitwiseand.
equality
equality: relation restequality.
restequality
restequality: e.
restequality: equalityoperator relation restequality.
equalityoperator
equalityoperator: "==".
equalityoperator: "!=".
relation
relation: shift restrelation.
restrelation
restrelation: e.
restrelation: relationoperator shift restrelation.
relationoperator
relationoperator: "<".
relationoperator: "<=".
relationoperator: ">".
relationoperator: ">=".
shift
shift: addition restshift.
restshift
restshift: e.
restshift: shiftoperator addition restshift.
shiftoperator
shiftoperator: "<<".
shiftoperator: ">>".
addition
addition: multiplication restaddition.
restaddition
restaddition: e.
restaddition: additionoperator multiplication restaddition.
additionoperator
additionoperator: "+".
additionoperator: "-".
multiplication
multiplication: unary3 restmultiplication.
restmultiplication
restmultiplication: e.
restmultiplication: multiplicationoperator unary3 restmultiplication.
multiplicationoperator
multiplicationoperator: "*".
multiplicationoperator: "/".
multiplicationoperator: "%".
unary3
unary3: unary2
unary3: unary3operator unary3.
unary3operator:
unary3operator: "&".
unary3operator: "*".
unary3operator: "~".
unary2
unary2: factor.
unary2: unary2operator unary2.
unary2operator
unary2operator: "+".
unary2operator: "-".
unary2operator: "!".
factor
factor: <identifier> application.
factor: immediate.
factor: "(" expression ")".
application
application: e.
application: "[" expression "]" application.
application: "(" expression moreexpressions ")".
moreexpressions
moreexpressions: e.
moreexpressions: "," expression morexpressions.
type
type: "bool".
type: "char".
type: "float".
type: "int".
type: "string".
immediate
immediate: <boolean_literal>.
immediate: <char_literal>.
immediate: <float_literal>.
immediate: <int_literal>.
immediate: <string_literal>.