]> Joshua Wise's Git repositories - snipe.git/blobdiff - parse/ast.sml
Add cast syntax.
[snipe.git] / parse / ast.sml
index ce756abb87e7714fb5988df088b4be3698653f30..9645f6ae9c17525dec83e013fd18f859b30fd45c 100644 (file)
@@ -38,6 +38,7 @@ sig
 
   datatype exp =
      Var of ident
 
   datatype exp =
      Var of ident
+   | Cast of Type.vtype * exp
    | ConstExp of Word32.word
    | StringExp of string
    | OpExp of oper * exp list
    | ConstExp of Word32.word
    | StringExp of string
    | OpExp of oper * exp list
@@ -109,6 +110,7 @@ struct
 
   datatype exp =
      Var of ident
 
   datatype exp =
      Var of ident
+   | Cast of Type.vtype * exp
    | ConstExp of Word32.word
    | StringExp of string
    | OpExp of oper * exp list
    | ConstExp of Word32.word
    | StringExp of string
    | OpExp of oper * exp list
@@ -172,6 +174,7 @@ struct
       | pp_oper GE = ">="
 
     fun pp_exp (Var(id)) = pp_ident id
       | pp_oper GE = ">="
 
     fun pp_exp (Var(id)) = pp_ident id
+      | pp_exp (Cast(ty, exp)) = "["^(Type.Print.pp_type ty)^"]"^(pp_exp exp)
       | pp_exp (ConstExp(c)) = Word32Signed.toString c
       | pp_exp (StringExp(s)) = "\"" ^ s ^ "\""
       | pp_exp (OpExp(oper, [e])) =
       | pp_exp (ConstExp(c)) = Word32Signed.toString c
       | pp_exp (StringExp(s)) = "\"" ^ s ^ "\""
       | pp_exp (OpExp(oper, [e])) =
This page took 0.021397 seconds and 4 git commands to generate.