Primordial Magic DSL Grammar
Primordial Magic DSL GrammarWIP Grammar for a DSL that can be used to represent the Primordial Magic Automata
Tokens
$identifier ::= [a-z][a-zA-Z0-9_]*
$number ::= [0-9]+
$comment ::= #.*\n
$typeID ::= [A-Z][a-z]*
$register ::= R[0-7] | TARGET
$eventID ::= touch | target
Grammar
@label ::= $identifier
@label_def ::= @label ->
@jump ::= jump @label
@event ::= on $eventType jump @label;
# Blocking, sets TARGET when activated
@branch ::= branch @expr jump @label;
| branch @expr jump @label else @label;
@expr ::= $register
| @constant
| @comparison
| @expr + @expr
| !@expr
| isnull @expr
@comparison ::= @expr < @expr
| @expr <= @expr
| @expr = @expr
| @expr > @expr
| @expr >= @expr
@constant ::= $number : $typeID
@set ::= set $register(, $register)* => @expr
@release ::= release $register
Anoniem (niet gecontroleerd)
ma, 25/03/2013 21:14