Skip to main content

module demo::lang::MissGrant::Step

rascal-0.40.17

Usage

import demo::lang::MissGrant::Step;

Dependencies

import demo::lang::MissGrant::ToRelation;
import Set;

alias Output

tuple[str state, list[str] commands]

function merge

Output merge(Output a, Output b) = <b.state, a.commands + b.commands>;

function eval

Output eval(TransRel trans, ActionRel commands, str init, list[str] tokens) =
// (<init,[]> | merge(step(trans,commands, it.state, token)) | token <- tokens);
(<init,[]> | merge(it, step(trans, commands, it[0], token)) | token <- tokens);

function step

Output step(TransRel trans, ActionRel commands, str state, str token) 
= <c, toList(commands[c])>
when c <- trans[state, token];