X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fast.ml;h=8e56fb5fbef44d981548d46dd5781d34fee63a6c;hb=54c8ad92025a9c77c2b10644499b3944e1299187;hp=922827c9cc2a9ed27dc842b22c48e9acd483aec0;hpb=976bb1b35d77f3058df3c25c1e2a4767147d606b;p=goals.git diff --git a/src/ast.ml b/src/ast.ml index 922827c..8e56fb5 100644 --- a/src/ast.ml +++ b/src/ast.ml @@ -54,11 +54,12 @@ and expr = and constant = | CString of string and goal = param_decl list * pattern list * expr list * code option -and func = param_decl list * code +and func = param_decl list * returning * bool * code and tactic = param_decl list * code and param_decl = id and id = string -and code = substs +and code = substs * bool +and returning = RetExpr | RetStrings | RetString and substs = subst list and subst = | SString of string @@ -161,17 +162,25 @@ and string_goal () (name, (param_decls, patterns, exprs, code)) = (String.concat ", " (List.map (string_param_decl ()) param_decls)) (String.concat ", " (List.map (string_pattern ()) patterns)) (String.concat ", " (List.map (string_expr ()) exprs)) - (match code with None -> "" | Some code -> " = { ... }") + (match code with None -> "" + | Some (code, false) -> " = { ... }" + | Some (code, true) -> " = @{ ... }") -and string_func () (name, (param_decls, code)) = - sprintf "function%s (%s) = { ... }" +and string_func () (name, (param_decls, returning, pure, (code, quiet))) = + sprintf "%sfunction%s returning %s (%s) = %s{ ... }" + (if pure then "pure " else "") (match name with None -> "" | Some name -> " " ^ name) + (match returning with RetExpr -> "expression" + | RetString -> "string" + | RetStrings -> "strings") (String.concat ", " (List.map (string_param_decl ()) param_decls)) + (if quiet then "@" else "") -and string_tactic () (name, (param_decls, code)) = - sprintf "tactic%s (%s) = { ... }" +and string_tactic () (name, (param_decls, (code, quiet))) = + sprintf "tactic%s (%s) = %s{ ... }" (match name with None -> "" | Some name -> " " ^ name) (String.concat ", " (List.map (string_param_decl ()) param_decls)) + (if quiet then "@" else "") and string_param_decl () name = name