Interpreter Version 0.01
Enter the program you want to interpret below:Output of the interpreter:
<program> ::= <exp>
<exp> ::= <var_exp>
| <fn_exp>
| <app_exp>
| <intlit_exp>
| <papp_exp>
<fn_exp> ::= fn '(' <var_exp>* ')' => <exp>
<app_exp> ::= '(' <exp> <exp>* ')'
<papp_exp> ::= <prim_op> '(' <args> ')'
<args> ::= ( <exp> ( ',' <exp> )* )?
<var_exp> ::= <LETTER> (<LETTER>|<DIGIT>|_)* <intlit_exp> ::= <DIGIT>+ <DIGIT> ::= 0 | 1 | 2 | ... | 8 | 9 <LETTER> ::= a | b | ... | z | A | B | ... | Z <prim_op> ::= + | * | add1
| Sample 1: | Integer literal | |
| Sample 2: | Variable | |
| Sample 3: | Primitive applications | |
| Sample 4: | Closure (constant function) | |
| Sample 5: | Closure (ident. function) | |
| Sample 6: | Closure (free variable) | |
| Sample 7: | Apply constant function | |
| Sample 8: | Apply ident. function | |
| Sample 9: | Apply function with free var. | |
| Sample 10: | Apply the square function | |
| Sample 11: | Higher-order fn: Apply twice | |
| Sample 12: | Higher-order fn: Compose |