Skip to main content

module demo::lang::Lisra::Runtime

rascal-0.40.17

Usage

import demo::lang::Lisra::Runtime;

Dependencies

import Prelude;

data Lval

data Lval  
= Integer(int n)
| Atom(str name)
| List(list[Lval] elms)
| Closure(Result(list[Lval] args, Env env))
;

alias Scope

map[Lval,Lval]

alias Env

list[Scope]

function makeEnv

Env makeEnv(list[Lval] vars, list[Lval] values, Env outer) =        
[(vars[i] : values[i] | i <- index(vars))] + outer;

function find

int find(Lval sym, Env e){        
for(n <- index(e))
if(e[n][sym]?)
return n;
return -1;
}

alias Result

tuple[Lval val, Env env]