From b1d92ca2ed927e4c5199dee9f9f69aaf7e570f5a Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 20 Feb 2018 05:49:46 -0600 Subject: [PATCH] read string first --- Makefile | 6 ++++-- lambda | Bin 0 -> 67845 bytes lambda.ml | 21 +++++++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100755 lambda diff --git a/Makefile b/Makefile index 0e2a1cd..8df607f 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ clean: rm -f lexer.ml parser.ml parser.mli rm -f *.cmo *.cmi -all: types.cmo lexer.cmo parser.cmo lambda.cmo - ocaml types.cmo parser.cmo lexer.cmo lambda.cmo +lambda: types.cmo lexer.cmo parser.cmo lambda.cmo + ocamlc -o $@ $^ + +all: lambda diff --git a/lambda b/lambda new file mode 100755 index 0000000000000000000000000000000000000000..8badaf7a349d3783fe38c0f1953ac95790c637df GIT binary patch literal 67845 zcmeI53z(f%dGBX3fy|Hy6a|6^nVHO^48on}1|D*D9 zp|RnNhBH+^UwDzQSXd*xSjY%lh3kdgLccI3+$}sH{HpLKAtx*o8U;$1aGJ1AXcIOG z6lj9zR2tS#N5lH*Xqsj~GkXR!r_6xn)EUssiD2=(aa zX|7Xf5&W987!Z@`e21LrXplJ_>kJbGoBhuJ#JSawyKt3pBS>SS!3lz$ZI|TZEi2 zBHSxHB)ndDoA6E{EvL}m{NAp%&rkC?{!61Xe$&xeo=!){JieTc&hm9SI?LJV=qzui zqqE#KI-k457$1?p_%Y63bf#GTvKIO-f!MR&)-n!!E@KM?dgkJoSw5R?_2?|8r=vs0 zOk!cVJsm&GZ|KtV`@Du1YR>2OmFjO3dW2EoLE+89?+YIg9v40>JSBWbAi+-)ULdpy zYlO>$YlItx9$`?>|4rJnX+DMJOnhMc%m*{c3)>Tx7c*G{fAq06SE)@r$tm=Q2l40< z&Jggq#j;=z2RBY<)d{kk80z5-9cPcz*MAGx5PM zg*6tFnXEZ0T2oISo+Z6LC+eRUg!Sg1nd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=-X$hy#1rzg= z|0l_s*I$-i*`nV#J}uF6t`hPT{Y_GngwIY|bM%)N&)07rH|fo@DH&n@)bM-KP_|qt z(;J(#es<%W)T#ud!w6mL1z0y7gO;Taw=t z-L9uveG9t2Ty586{Aesa=pJV+oP(rZCTrC?HgNL+m@~yA5LDi zTa(Yy`uRlb()KG`+i&e&UtYcD#`644e6`l}hA_N^A3`J_#JlusorC($oyn9x#mwTg zxlxgMSm;0A*zo!%l9G8evp9L=?`-JLbgGlQb#*rEd_psqb?Nu3^>H9y(l6XxmHhU^ zW_=IHjdpI&bZ&k$vxxWG&W5X=fOtt+ht9@^M-oQKGka&lSY~qg}(y;iin#U3`N+j;eD9l-JjO`{}w`#5-$0Om$^Mcf+LbPF-Dy z-}2~<_JOKvb0Yhu>gT1dtHkZ))h}9IosxgE|5DY}jS{zX#9ykqwrJ(9=o3`eH4yJ! z!xysZC#bHiBHgp5_6tG#FJW_hz)A>(c_T)W}Gv-?po8I!&(6hV#?7PoCef_-O{)`rF<@acgb$s!$WwRdo%wNCpmQN2o`PiYtc~XIm zbgX0R{M_ybf8&XFJ#Wt~FM0h%uYLOX@wz+kSjVB?d-(MC?fm_H-3y+&;ieD2ajy6$ zd-qt!qo4codyXz0S^b@(cRc_7mp7iNnPiI}>p0{63vYbwJ6`?4)1Q9#!F^vk_Ki%} zj_xfD4WAw8-u_bl-l(B_`}UpGFTH;2b@~&%|I*!gL#MvuzGmkw*KO9T$hlqDcWHhW Uf15Xl!(r`)4I6ImSiAQB0u67$LI3~& literal 0 HcmV?d00001 diff --git a/lambda.ml b/lambda.ml index 3655348..137be98 100644 --- a/lambda.ml +++ b/lambda.ml @@ -82,14 +82,15 @@ let rec eval (ctx, t) = if t = t' then raise EvaluationComplete else eval (ctx', t') with - | UnboundVariable v -> print_endline ("unbound variable " ^ v); raise (Failure "") + | UnboundVariable v -> raise (Failure ("unbound variable '" ^ v ^ "'")) | EvaluationComplete -> (ctx, t) let _ = - try - let rec loop ctx = + let rec loop ctx = + try print_string "> "; flush stdout; - let lexbuf = Lexing.from_channel stdin in + let line = input_line stdin in + let lexbuf = Lexing.from_string line in let x = Parser.main Lexer.token lexbuf in match x with | Types.Term t -> @@ -99,7 +100,11 @@ let _ = | Types.Assign (n, t) -> let (ctx', r) = eval (ctx, t) in loop (assign ctx' (n, r)) - in loop [] - with Lexer.Eof -> - print_endline "^D"; - exit 0 + with + | Lexer.Eof -> + loop ctx + | End_of_file -> + print_endline "^D"; + exit 0 + in loop [] +