slides/slides09.tex
changeset 381 47eceea734c5
parent 380 1e88390e81aa
child 383 a6a6bf32fade
equal deleted inserted replaced
380:1e88390e81aa 381:47eceea734c5
   115 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
   115 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
   116 abstract class Exp
   116 abstract class Exp
   117 abstract class BExp 
   117 abstract class BExp 
   118 abstract class Decl
   118 abstract class Decl
   119 
   119 
   120 case class 
       
   121   Def(name: String, args: List[String], body: Exp) 
       
   122                                           extends Decl
       
   123 case class Main(e: Exp) extends Decl
       
   124 
       
   125 case class Call(name: String, args: List[Exp]) extends Exp
       
   126 case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
       
   127 case class Write(e: Exp) extends Exp
       
   128 case class Var(s: String) extends Exp
   120 case class Var(s: String) extends Exp
   129 case class Num(i: Int) extends Exp
   121 case class Num(i: Int) extends Exp
   130 case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
   122 case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
       
   123 case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
       
   124 case class Write(e: Exp) extends Exp
   131 case class Sequ(e1: Exp, e2: Exp) extends Exp
   125 case class Sequ(e1: Exp, e2: Exp) extends Exp
       
   126 case class Call(name: String, args: List[Exp]) extends Exp
       
   127 
   132 case class Bop(o: String, a1: Exp, a2: Exp) extends BExp
   128 case class Bop(o: String, a1: Exp, a2: Exp) extends BExp
       
   129 
       
   130 case class Def(name: String, 
       
   131                args: List[String], 
       
   132                body: Exp) extends Decl
       
   133 case class Main(e: Exp) extends Decl
   133 \end{lstlisting}
   134 \end{lstlisting}
   134 
   135 
   135 \end{frame}
   136 \end{frame}
   136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   137 
   138