Stefan pushed to branch master at Stefan / Typer
Commits: 6fa07a98 by Stefan Monnier at 2016-03-24T17:15:11-04:00 Fix compilation yet again; Fix the "executable bit" in various files
* tests/REPL.ml (ieval): Fix type error. * src/eval.ml (eval_all): Reduce redundancy.
- - - - -
13 changed files:
- DESIGN - GNUmakefile - − _tags - − side-effects - src/debruijn.ml - src/eval.ml - src/fmt.ml - src/grammar.ml - src/lexp.ml - src/prelexer.ml - tests/REPL.ml - tests/debug.ml - tests/full_debug.ml
Changes:
===================================== DESIGN ===================================== --- a/DESIGN +++ b/DESIGN @@ -1616,6 +1616,7 @@ Or almost: with these classical definitions we cannot prove the classical axiom of choice as a theorem, so if you need it, you have to add it as an axiom.
* Papers +** BigBang: Designing a statically typed scripting language ** Dependently typed Racket ** Dependently typed Haskell "My dissertation (github.com/goldfirere/thesis) is about adding dependent
===================================== GNUmakefile ===================================== --- a/GNUmakefile +++ b/GNUmakefile
===================================== _tags deleted ===================================== --- a/_tags +++ /dev/null
===================================== side-effects deleted ===================================== --- a/side-effects +++ /dev/null @@ -1 +0,0 @@ -../papers/side-effects \ No newline at end of file
===================================== src/debruijn.ml ===================================== --- a/src/debruijn.ml +++ b/src/debruijn.ml
===================================== src/eval.ml ===================================== --- a/src/eval.ml +++ b/src/eval.ml @@ -439,10 +439,8 @@ let debug_eval lxp ctx =
(* Eval a list of lexp *) let eval_all lxps rctx silent = - if silent then - List.map (fun g -> eval g rctx) lxps - else - List.map (fun g -> debug_eval g rctx) lxps;; + let evalfun = if silent then eval else debug_eval in + List.map (fun g -> evalfun g rctx) lxps;;
(* Eval String * ---------------------- *)
===================================== src/fmt.ml ===================================== --- a/src/fmt.ml +++ b/src/fmt.ml
===================================== src/grammar.ml ===================================== --- a/src/grammar.ml +++ b/src/grammar.ml
===================================== src/lexp.ml ===================================== --- a/src/lexp.ml +++ b/src/lexp.ml
===================================== src/prelexer.ml ===================================== --- a/src/prelexer.ml +++ b/src/prelexer.ml @@ -1,6 +1,6 @@ (* prelexer.ml --- First half of lexical analysis of Typer.
-Copyright (C) 2011-2012 Free Software Foundation, Inc. +Copyright (C) 2011-2012, 2016 Free Software Foundation, Inc.
Author: Stefan Monnier monnier@iro.umontreal.ca Keywords: languages, lisp, dependent types. @@ -134,17 +134,18 @@ let rec prelex (file : string) (fin : in_channel) ln ctx acc | ((ln, cpos, _, _) :: ctx) -> (prelexer_error {file=file; line=ln; column=cpos} "Unmatched opening brace"; List.rev acc) - - + + let prelex_file file = let fin = open_in file in prelex file fin 1 [] [] (* Traditionally, line numbers start at 1 :-( *) - + (* Since current implementation is not compatible with stream * * we write a temporary file and use this file as input. * * This is a terrible solution but for the things we do it does not * - * really matters. Plus it will make testing easier *) -let prelex_string str = + * really matters. Plus it will make testing easier. *) +let prelex_string str = + (* FIXME: we should use a proper temp file (e.g. with mktemp). *) let fin = open_out "_temp_hack" in output_string fin str; (flush_all); @@ -162,8 +163,3 @@ let rec pretokens_print pretokens = | Prestring(_, str) -> print_string """; print_string str; print_string """) pretokens - - - - - \ No newline at end of file
===================================== tests/REPL.ml ===================================== --- a/tests/REPL.ml +++ b/tests/REPL.ml @@ -1,3 +1,24 @@ +(* REPL.ml --- Read Eval Print Loop (REPL) + +Copyright (C) 2016 Pierre Delaunay + +Author: Pierre Delaunay pierre.delaunay@hec.ca + +This file is part of Typer. + +Typer is free software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any +later version. + +Typer is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see http://www.gnu.org/licenses/. *) + (* * Description: * Read Eval Print Loop (REPL). It allows you to eval typer code @@ -13,7 +34,7 @@ * . a + b; * Out[ 3] >> 6 * - * --------------------------------------------------------------------------- *) + * -------------------------------------------------------------------------- *)
open Debug @@ -99,7 +120,7 @@ let ilexp_parse pexps lctx = let ieval lexps rctx = let (ldecls, lexprs) = lexps in let rctx = eval_decls ldecls rctx in - let vals = eval_all lexprs rctx in + let vals = eval_all lexprs rctx false in vals, rctx ;;
===================================== tests/debug.ml ===================================== --- a/tests/debug.ml +++ b/tests/debug.ml
===================================== tests/full_debug.ml ===================================== --- a/tests/full_debug.ml +++ b/tests/full_debug.ml
View it on GitLab: https://gitlab.com/monnier/typer/commit/6fa07a985f46b2881ed04a3c603b1c316724...