Here you can run our evaluator on some existing programs, or enter your own.
Choose one of the examples below and click Go to see the result.
Our language is a core fragment of the Fortress programming language. As such, all programs in this language are valid Fortress programs. Note that Fortress supports unicode characters. However, this evaluator does not. In particular, we use [\ and \] as the ASCII equivalent of white square brackets.
For questions and comments, and to report problems, please contact jhallett at cs dot bu dot edu.
p := ds e (program)
d := td
| od
ds := empty
| d ds
td := trait T *tps* *extends supers* *where htvs* mds end (trait declaration)
od := object O *tps* *vps* *extends supers* *where htvs* mds end (object declaration)
tps := [\ bnds \] (type parameters)
vps := [\ params \] (value parameters)
supers := { exts } (supertypes)
htvs := { bnds } (hidden type variables)
bnds := empty
| X extends A (upper bound)
| X bounds A (lower bound)
| X extends A, bnds
| X bounds A, bnds
params := empty
| x : A
| x : A, params
exts := empty
| M *where htvs*
| M *where htvs*, exts
md := m *tps* vps : A = e (method declaration)
mds := empty
| md mds
e := x (program variable)
| self (self reference)
| O *[\ As \]* ( es ) (object instance)
| e.x (field access)
| e.m *[\ As \]* ( es ) (method call)
| e as A (type ascription)
| typecase x = e of cases else => e end (typecase)
es := empty
| e
| e, es
A := X (type variable)
| O [\ A \] (object type)
| M
As := empty
| A
| A, As
M := T [\ As \] (trait type)
| Object (type of object)
cases := empty
| A => e
| A => e, cases