Implementation Details
Implementation DetailsThese pages contain details about how the system is implemented.
Anonymous (not verified) Wed, 08-10-2014 14:44Primordial Magic DSL Example
Primordial Magic DSL ExampleAn example automaton that creates a small burst of fire.
# Program start
start -> # 0;
# Gather energy
set R1 => 2 : Fire # 3;
set R2 => 1 : Water # 5;
# Wait until a target is chosen then execute the rest, this sets TARGET register
on target jump target # 10;
target -> # 10;
# Combine Fire and Water to get Fire and Energy
set R1, R2 => R1 + R2 # 15;
# Combine Energy with Direction to get Force
set R2 => R2 + TARGET # 19;
# Apply force to fire to gain a missile
set R1 => R1 + R2 # 23;
# Release the energy of the missile to finish the spell
release R1 # 24;
Anonymous (not verified)
Mon, 25-03-2013 21:21
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
Anonymous (not verified)
Mon, 25-03-2013 21:14