diff options
Diffstat (limited to 'gf-book/examples/chapter8/CalculatorJ.gf')
| -rw-r--r-- | gf-book/examples/chapter8/CalculatorJ.gf | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gf-book/examples/chapter8/CalculatorJ.gf b/gf-book/examples/chapter8/CalculatorJ.gf new file mode 100644 index 000000000..c5f40c8d3 --- /dev/null +++ b/gf-book/examples/chapter8/CalculatorJ.gf @@ -0,0 +1,13 @@ +concrete CalculatorJ of Calculator = open Prelude in { +lincat + Exp = SS ; +lin + EPlus = postfix "iadd" ; + EMinus = postfix "isub" ; + ETimes = postfix "imul" ; + EDiv = postfix "idiv" ; + EInt i = ss ("ldc" ++ i.s) ; +oper + postfix : Str -> SS -> SS -> SS = \op,x,y -> + ss (x.s ++ ";" ++ y.s ++ ";" ++ op) ; +} |
