Commit 6a9bf556 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][EVAL] make check fixed; split main from parser

parent e424ca5b
...@@ -11,7 +11,7 @@ INEXTFILES = misc/custom.ml misc/encodings.ml types/ident.ml\ ...@@ -11,7 +11,7 @@ INEXTFILES = misc/custom.ml misc/encodings.ml types/ident.ml\
EXTFILES = $(INEXTFILES:%=$(ROOTDIR)/%) EXTFILES = $(INEXTFILES:%=$(ROOTDIR)/%)
RM ?= rm -f RM ?= rm -f
OUT ?= lambda.native OUT ?= main.native
.PHONY: clean check test .PHONY: clean check test
......
<src>: include <src>: include
<src/lambda*>: pp(camlp4orf.opt), package(camlp4.lib) <src/lambda*>: pp(camlp4orf.opt), package(camlp4.lib)
<src/main*>: pp(camlp4orf.opt), package(camlp4.lib)
...@@ -97,11 +97,3 @@ and branches_to_string b = match b with ...@@ -97,11 +97,3 @@ and branches_to_string b = match b with
| (br, Some x, exp) :: rest -> "\n| " ^ (expr_to_string br) ^ " & " ^ x | (br, Some x, exp) :: rest -> "\n| " ^ (expr_to_string br) ^ " & " ^ x
^ " -> " ^ (expr_to_string exp) ^ (branches_to_string rest) ^ " -> " ^ (expr_to_string exp) ^ (branches_to_string rest)
| [] -> "";; | [] -> "";;
let str = "fun firsts x y -> match x,y with
| (a,_),(b,_) -> a,b (* This (* is (* a nested *) *) comment *)
| _ -> x (* That doesn't make any sense *)" in
let expr = ExprParser.of_string str in
printf "Original: %s\nExpr: " str;
print_expr expr;
printf "\nResult: %s\n" (expr_to_string expr)
open Printf
open Lambda
let load_file f =
let ic = open_in f in
let n = in_channel_length ic in
let s = String.create n in
really_input ic s 0 n;
close_in ic;
s;;
let str = if Array.length Sys.argv > 1 then load_file Sys.argv.(1)
else "fun firsts x y -> match x,y with
| (a,_),(b,_) -> a,b (* This (* is (* a nested *) *) comment *)
| _ -> x (* That doesn't make any sense *)" in
let expr = ExprParser.of_string str in
printf "Original: %s\nExpr: " str;
print_expr expr;
printf "\nResult: %s\n" (expr_to_string expr)
Original: fun f a->a
Expr: Abstract(f a, Var(a))
Result: fun f a -> a
Keyword: let
Id: a
Operator: =
Int: 2
Keyword: let
Id: a
Operator: =
Int: 2
Keyword: let
Id: a
Operator: =
Int: 2
Keyword: let
Id: a
Operator: =
Int: 2
let a = 2
let a =2
let a= 2
let a=2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment