This package realises an interpreter for the functional language EXP described in the lecture notes "Einführung in die Theorie der Informatik" by G. Salzer which we call EXPi. EXPi was written by Christoph Rettig as part of the computer science curriculum in an Informatik-Praktikum.
The purpose of the interpreter is, given as input a specification of
<input file> --> <evaluationlist>
<evaluationlist> --> '<evaluations' <evaluations> '>'
<evaluations> --> <eval> <evaluations>
| < eval >
<eval> --> '<eval"' <string> '"'
'calltype="' <calltype>
'datatype="' <datatype>
'fvsenv=' <fvsenv>
'ivsenv="' <ivsenv> '"'
'exp="' <exp> '"'
<calltype> --> 'cnb'
| 'cbv'
<datatype> --> 'numbers'
| 'binarystacks'
| 'lists'
| 'strings'
<fvsenv> --> '"' <fenv> '"' <fvsenv>
| <empty>
<fenv> --> '@' <fenvname> '=' <exp>
<fenvname> --> <char-or-digit> <fenvname>
| <char-or-digit>
<char-or-digit> --> <char>
| <digit>
<number> --> '0'
| <not-null-digit> <number>
<string> --> <char> <string>
| <digit> <string>
<char> --> <lower-char>
| <upper-char>
<lower-char> --> 'a' | ... | 'z'
<upper-char> --> 'A' | ... | 'Z'
<digit> --> '0' | ... | '9'
<not-null-digit> --> '1' | ... | '9'
<ivsenv> --> 'I(' <ivs> ')=' <constant> <ivsenv>
| <empty>
<ivs> --> 'x' <number>
| 'y' <number>
| 'z' <number>
<constants> --> 'leer' <domain> --> 'leer' | <01sequence> <01sequence> --> '0' <01sequence> | '1' <01sequence> | '0' | '1' <functions> --> 'push0' | 'push1' | 'pop' <predicates> --> 'ist0?' | 'ist1?' | 'istleer?'
<constants> --> ''('')''
| <atom>
<domain> --> <lists>
<atom_> --> <char> <atom_>
| <char>
<atom> --> ''' <atom_> '''
<list> --> <atom>
| ''('')''
| ''('' <lis> '')''
<lists> --> <list> <lists>
| <list>
<functions> --> 'first'
| 'rest'
| 'build'
<predicates> --> 'atom?'
| 'eq?'
<constants> --> <number> <domain> --> <number> <functions> --> 'plus' | 'minus' | 'prod' <predicates> --> 'smaller' | 'equal'
<constants> --> <string>
| '{}'
<domain> --> <string>
<functions> --> 'ring'
<predicates> --> 'pref'
<evaluations
<eval "ue 3.6"
calltype = cbn
datatype = numbers
fvsenv = "@F = prod(if equal(x1,0) then x2 else minus(1,x1),x2)"
ivsenv = "I(x) = 1 I(z) = 1"
exp = "F(minus(1,x),plus(z,1))"
>
<eval "ue 3.7"
calltype = cbn
datatype = binarystacks
fvsenv = "@F = if istleer?(x2) then leer else F(G(x1), pop(x2))"
"@G = G(x1)"
ivsenv = "I(x) = 1"
exp = "F(x,x)"
>
<eval "ue 3.19"
calltype = cbn
datatype = lists
fvsenv = "@F = build(x1,'('')')"
ivsenv = "I(y) = '(' 'A' ')'"
exp = "if atom?(F(y)) then F(F(y)) else first(F(y))"
>
>
cd <path to EXPi>/prolog/After this type
sicstus -l ./expi.pl
evalfile("").
where <inputfilename> stands for the name you gave to your input file and
<path to input file> is the path to your input file.