Quellcode durchsuchen

Merge branch 'IUCompilerCourse-master'

Peter Thiemann vor 3 Jahren
Ursprung
Commit
46393b601d
2 geänderte Dateien mit 262 neuen und 224 gelöschten Zeilen
  1. 233 206
      book.tex
  2. 29 18
      defs.tex

Datei-Diff unterdrückt, da er zu groß ist
+ 233 - 206
book.tex


+ 29 - 18
defs.tex

@@ -127,11 +127,12 @@
 \if\edition\racketEd
 \newcommand{\INT}[1]{{\key{(Int}~#1\key{)}}}
 \newcommand{\READOP}{{\key{read}}}
-\newcommand{\READ}{{\key{(Prim}~\code{read}~\key{())}}}
+\newcommand{\READ}{{\key{(Prim}~\code{'read}~\key{())}}}
 \newcommand{\CREAD}{\key{(read)}}
-\newcommand{\NEG}[1]{{\key{(Prim}~\code{-}~\code{(}#1\code{))}}}
-\newcommand{\ADD}[2]{{\key{(Prim}~\code{+}~\code{(}#1~#2\code{))}}}
-\newcommand{\SUB}[2]{\key{(Prim}~\code{-}~\code{(}#1~#2\code{))}}
+\newcommand{\NEG}[1]{{\key{(Prim}~\code{'-}~\code{(}#1\code{))}}}
+\newcommand{\ADD}[2]{{\key{(Prim}~\code{'+}~\code{(}#1~#2\code{))}}}
+\newcommand{\ADDP}[2]{{\key{(Prim}~\code{'+}~\code{(list}~#1~#2\code{))}}}
+\newcommand{\SUB}[2]{\key{(Prim}~\code{'-}~\code{(}#1~#2\code{))}}
 \newcommand{\PROGRAM}[2]{\LP\code{Program}~#1~#2\RP}
 \newcommand{\VAR}[1]{\key{(Var}~#1\key{)}}
 \newcommand{\BOOL}[1]{\key{(Bool}~#1\key{)}}
@@ -144,13 +145,15 @@
 \newcommand{\CEQ}[2]{\LP\key{eq?}~#1~#2\RP}
 \newcommand{\IF}[3]{\key{(If}\,#1~#2~#3\key{)}}
 \newcommand{\CIF}[3]{\LP\key{if}~#1~#2~#3\RP}
-\newcommand{\AND}[2]{\key{(Prim}~\code{and}~\code{(}#1~#2\code{))}}
-\newcommand{\OR}[2]{\key{(Prim}~\code{or}~\code{(}#1~#2\code{))}}
-\newcommand{\CAND}[2]{\CBINOP{\key{and}}{#1}{#2}}
-\newcommand{\COR}[2]{\CBINOP{\key{or}}{#1}{#2}}
+\newcommand{\AND}[2]{\key{(Prim}~\code{'and}~\code{(}#1~#2\code{))}}
+\newcommand{\OR}[2]{\key{(Prim}~\code{'or}~\code{(}#1~#2\code{))}}
+\newcommand{\CAND}[2]{\CBINOP{\key{'and}}{#1}{#2}}
+\newcommand{\COR}[2]{\CBINOP{\key{'or}}{#1}{#2}}
 \newcommand{\INTTY}{{\key{Integer}}}
+\newcommand{\INTTYPE}{{\key{Integer}}}
 \newcommand{\BOOLTY}{{\key{Boolean}}}
 \newcommand{\VECTY}[1]{{\LP\key{Vector}#1\RP}}
+\newcommand{\ANYTY}{{\key{any}}}
 \newcommand{\CPROGRAM}[2]{\LP\code{CProgram}~#1~#2\RP}
 \newcommand{\CPROGRAMDEFS}[2]{\LP\code{CProgramDefs}~#1~#2\RP}
 \newcommand{\LET}[3]{\key{(Let}~#1~#2~#3\key{)}}
@@ -163,6 +166,8 @@
 \newcommand{\CGLOBAL}[1]{#1\key{(\%rip)}}
 \newcommand{\GLOBALVALUE}[1]{\LP\key{GlobalValue}~#1\RP}
 \newcommand{\CGLOBALVALUE}[1]{\LP\key{global-value}~#1\RP}
+\newcommand{\ARITY}[1]{\LP\key{Prim}~\code{'procedure-arity}~\LP#1\RP\RP}
+\newcommand{\CARITY}[1]{\LP\key{procedure-arity}~#1\RP}
 \fi
 
 \if\edition\pythonEd
@@ -175,6 +180,7 @@
 \newcommand{\CREAD}{\key{input\_int()}}
 \newcommand{\NEG}[1]{{\key{UnaryOp(USub(),} #1\code{)}}}
 \newcommand{\ADD}[2]{{\key{BinOp}\LP #1\code{,} \key{Add()}\key{,}#2\code{)}}}
+\newcommand{\ADDP}[2]{{\key{BinOp}\LP #1\code{,} \key{Add()}\key{,}#2\code{)}}}
 \newcommand{\SUB}[2]{{\key{BinOp}\LP \key{Sub()}\key{,}#1\code{,}#2\code{)}}}
 \newcommand{\PRINT}[1]{{\key{Expr}\LP\key{Call}\LP\key{Name}\LP\key{'print'}\RP\key{,}\LS#1\RS\RP\RP}}
 \newcommand{\CPRINT}[1]{\key{print}\LP #1\RP}
@@ -209,7 +215,9 @@
 \newcommand{\COR}[2]{#1~\key{or}~#2}
 \newcommand{\INTTY}{{\key{int}}}
 \newcommand{\BOOLTY}{{\key{bool}}}
+\newcommand{\ANYTY}{{\key{AnyType}}}
 \newcommand{\VECTY}[1]{{\key{TupleType}\LP\LS #1 \RS\RP}}
+\newcommand{\INTTYPE}{{\key{IntType}}}
 \newcommand{\COLLECT}[1]{\key{Collect}\LP#1\RP}
 \newcommand{\CCOLLECT}[1]{\key{collect}\LP#1\RP}
 \newcommand{\ALLOCATE}[2]{\key{Allocate}\LP#1,#2\RP}
@@ -223,8 +231,11 @@
 \newcommand{\CALL}[2]{\key{Call}\LP#1\code{, }#2\RP}
 \newcommand{\APPLY}[2]{\key{Call}\LP#1\code{, }#2\RP}
 \newcommand{\CAPPLY}[2]{#1\LP#2\RP}
-\newcommand{\FUNREF}[1]{\key{FunRef}\LP#1\RP}
-\newcommand{\CFUNREF}[1]{#1\code{(\%rip)}}
+\newcommand{\FUNREF}[2]{\key{FunRef}\LP#1\code{, }#2\RP}
+\newcommand{\CFUNREF}[2]{#1\code{(\%rip)}}
+\newcommand{\CLOSURE}[2]{\key{Closure}\LP#1\code{, }#2\RP}
+\newcommand{\ARITY}[1]{\key{Call}\LP\key{Name}\LP\code{'arity'}\RP \code{, }\LS#1\RS\RP}
+\newcommand{\CARITY}[1]{\key{arity}\LP#1\RP}
 \fi % pythonEd
 
 \if\edition\racketEd
@@ -233,10 +244,11 @@
 \newcommand{\CNEG}[1]{\LP\key{-}~#1\RP}
 \newcommand{\CNOT}[1]{\LP\key{not}~#1\RP}
 \newcommand{\CALL}[2]{\key{Call}\LP #1\code{, } #2 \RP}
-\newcommand{\APPLY}[2]{\key{(Apply}~#1~#2\code{)}}
+\newcommand{\APPLY}[2]{\LP\key{Apply}~#1~#2\RP}
 \newcommand{\CAPPLY}[2]{\LP#1~#2\RP}
-\newcommand{\FUNREF}[1]{\LP\key{FunRef}~#1\RP}
-\newcommand{\CFUNREF}[1]{\key{(fun-ref}~#1\code{)}}
+\newcommand{\FUNREF}[2]{\LP\key{FunRef}~#1~#2\RP}
+\newcommand{\CFUNREF}[2]{\LP\key{fun-ref}~#1~#2\RP}
+\newcommand{\CLOSURE}[2]{\LP\key{Closure}~#1~#2\RP}
 \fi
 \newcommand{\PRIM}[2]{\LP\key{Prim}~#1~\LP #2\RP\RP}
 \newcommand{\PROGRAMDEFSEXP}[3]{\code{(ProgramDefsExp}~#1~#2~#3\code{)}}
@@ -259,17 +271,14 @@
 \newcommand{\ANYVECREF}[2]{\LP\key{Prim}~\code{any-vector-ref}~\LP #1~#2\RP\RP}
 \newcommand{\ANYVECSET}[3]{\LP\key{Prim}~\code{any-vector-set!}~\LP #1~#2~#3\RP\RP}
 \newcommand{\ANYVECLEN}[1]{\LP\key{Prim}~\code{any-vector-length}~\LP #1\RP\RP}
-\newcommand{\CLOSURE}[2]{\LP\key{Closure}~#1~#2\RP}
-\newcommand{\ALLOC}[2]{\LP\key{Allocate}~#1~#2\RP}
-\newcommand{\ALLOCCLOS}[3]{\LP\key{AllocateClosure}~#1~#2~#3\RP}
 
 \newcommand{\VOID}{\key{(Void)}}
-\newcommand{\FUNREFARITY}[2]{\key{(FunRefArity}~#1~#2\code{)}}
-\newcommand{\CFUNREFARITY}[2]{\key{(fun-ref-arity}~#1~#2\code{)}}
 \newcommand{\CGLAMBDA}[3]{\LP\key{lambda:}\,#1\,#2~\Exp\RP}
 \newcommand{\VALUEOF}[2]{\LP\key{ValueOf}~#1~#2\RP}
 
 \if\edition\racketEd
+\newcommand{\ALLOC}[2]{\LP\key{Allocate}~#1~#2\RP}
+\newcommand{\ALLOCCLOS}[3]{\LP\key{AllocateClosure}~#1~#2~#3\RP}
 \newcommand{\INJECT}[2]{\LP\key{Inject}~#1~#2\RP}
 \newcommand{\PROJECT}[2]{\LP\key{Project}~#1~#2\RP}
 \newcommand{\CINJECT}[2]{\LP\key{inject}~#1~#2\RP}
@@ -287,6 +296,8 @@
 \newcommand{\FUNDEF}[5]{\key{(Def}~#1~#2~#3~#4~#5\code{)}}
 \fi
 \if\edition\pythonEd
+\newcommand{\ALLOC}[2]{\key{Allocate}\LP#1\code{, }#2\RP}
+\newcommand{\ALLOCCLOS}[3]{\key{AllocateClosure}\LP#1\code{, }#2\code{, }#3\RP}
 \newcommand{\INJECT}[2]{\key{Inject}\LP#1\key{, }#2\RP}
 \newcommand{\PROJECT}[2]{\key{Project}\LP#1\key{, }#2\RP}
 \newcommand{\CINJECT}[2]{\sfm{inject}\LP#1\key{, }#2\RP}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.