summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-01-16Another useful monomorphisation rewriteBrian Campbell
2018-01-15Check monomorphisation case split size once for each patternBrian Campbell
(rather than for each argument separately)
2018-01-15Support non-trivial literal patternsBrian Campbell
Previously we only did top-level literal pattern to guard conversion, this does it throughout any pattern
2018-01-12Try to keep types for undefined around during monomorphisationBrian Campbell
Otherwise the type checker can't figure it out when we substitute
2018-01-12Remove generic comparisonBrian Campbell
2018-01-12Support constant propagation on casts in monomorphisationBrian Campbell
2018-01-10Add an all_split_errors optionBrian Campbell
2018-01-10Fix control dependencies in monomorphisation analysisBrian Campbell
2018-01-09More monomorphisation rewrites for aarch64Brian Campbell
2018-01-09Tidy up monomorphisation interfaceBrian Campbell
2018-01-09Proper location for no set constraint errorsBrian Campbell
2018-01-09Move reordering in alpha_equivalent before relabelling to giveBrian Campbell
consistent names
2018-01-09Add some optional experimental rewrites to help with monomorphisationBrian Campbell
2018-01-08Improved fix for alpha-equivalence re-ordering issueAlasdair Armstrong
2018-01-08Merge branch 'experiments' of https://bitbucket.org/Peter_Sewell/sail into ↵Alasdair Armstrong
experiments
2018-01-08Potential fix for bug where different quantifer order in existentials will ↵Alasdair Armstrong
break alpha-equivalence.
2017-12-19Support user-defined exceptions in Lem shallow embeddingThomas Bauereiss
The type-checker already supports a user-defined "exception" type that can be used in throw and try-catch expressions. This patch adds support for that to the Lem shallow embedding by adapting the existing exception mechanisms of the state and prompt monads. User-defined exceptions are distinguished from builtin exception cases. For example, the state monad uses type ex 'e = | Exit | Assert of string | Throw of 'e to distinguish between calls to "exit", failed assertions, and user-defined exceptions, respectively. Early return is also handled using the exception mechanism, by lifting to a monad with "either 'r exception" as the exception type, where 'r is the expected return type and "exception" is the user-defined exception type.
2017-12-19Add rewriting step for numeral patternsThomas Bauereiss
Pattern matching against literal numbers is not well supported by Lem or Isabelle. This rewriting step turns them into guarded patterns (which can be picked up by the guarded pattern rewriting to if-expressions).
2017-12-19Fix a bug in untupling function arguments for LemThomas Bauereiss
Was missing the case where the tuple of arguments is bound against a single variable using P_id (not P_as). Now replaces that with the expected number of argument variables, and rebinds the single variable in the body, as for the other cases.
2017-12-18Clean up last commitBrian Campbell
2017-12-18Handle multiple -lem_lib optionsBrian Campbell
2017-12-14Un-tuple function arguments when pretty-printing to LemThomas Bauereiss
This makes Lem prefer plain "definition" when generating Isabelle output for functions, which is processed by Isabelle much faster than "fun"/"function" definitions. This change is not complete yet, because the Sail library functions still need to be changed to not use tupled arguments (possibly as part of a bigger refactoring of the library). For now, external functions are special-cased in the pretty-printer and get tupled arguments.
2017-12-14Make sequential and mwords global variables in Lem pretty-printerThomas Bauereiss
2017-12-12Add a few helper functions for bit listsThomas Bauereiss
2017-12-12Make mono analysis fail properly on effectful functionsBrian Campbell
2017-12-11Remove some duplication from monomorphisation analysis failure reportsBrian Campbell
2017-12-07More OCaml test casesAlasdair Armstrong
Improved handling of try/catch Better handling of unprovable constraints when the environment contains false
2017-12-07Fix boolean literal constraintsAlasdair Armstrong
2017-12-07Fix regressions in OCaml outputAlasdair Armstrong
Recent patches have made the rewriter more strict about performing type correct rewrites. This is mostly a good thing but did cause some problems with the ocaml backend. Currently the sizeof rewriter doesn't seem to preserve type correctness - I suspect this is because when it resolves the sizeofs, it generates constraints that are true, but not in a form where the typechecker can see that they are true. I disabled the re-check after the sizeof rewriting pass to fix this. Maybe we don't want to do this anyway because it's slow. Changes to function clauses with guards + monomorphisation changed how the typechecker handles literal patterns. I added a rewriting pass to rewrite literals to guarded equality checks, which is run before generating ocaml. The rewriter currently uses Env.empty in a view places. This can cause bugs because Env.empty is a totally unitialised environment that doesn't satisfy invariants we expect of an environment. This should be changed to initial_env and it shouldn't be exported, I fixed a few cases where this caused things to go wrong, but it should probably not be exported from Type_check.ml.
2017-12-07Support monomorphisation with set constrained integersBrian Campbell
Also, to support this, constant propagation for integer multiply, fix substitution of concrete values for nvars, size parameters in single argument functions, fix kind for itself, add eq_atom to prelude
2017-12-07Resolve function clause guard parsing ambiguity by requiring parenthesesBrian Campbell
2017-12-07Functions with guards changes in rewritesBrian Campbell
2017-12-06Add parsing for guards in function clausesBrian Campbell
Breaks parsing ambiguities by removing = as an identifier in the old parser and requiring parentheses for some expressions in the new parser
2017-12-06Remove filename mangling in monomorphisationBrian Campbell
Broke analysis a little
2017-12-06Rework case checking to only introduce guards when necessaryBrian Campbell
2017-12-06Add top-level pattern match guards internallyBrian Campbell
Also fix bug in mono analysis with generated variables Breaks lots of typechecking tests because it generates unnecessary equality tests on units (and the tests don't have generic equality), which I'll fix next.
2017-12-06Merge remote branch 'experiments' into experimentsThomas Bauereiss
2017-12-06Make AST after rewriting for Lem backend type-checkableThomas Bauereiss
- Add support for some internal nodes to type checker - Add more explicit type annotations during rewriting - Remove hardcoded rewrites for E_vector_update etc from Lem pretty-printer; these will be resolved by the type checker during rewriting now
2017-12-05Better support for exceptions in sail for ASL specs that need them.Alasdair Armstrong
2017-12-05Update license headers for Sail sourceAlasdair Armstrong
2017-12-05Pretty printer now prints operator precedence correctly.Alasdair Armstrong
Also some simple rules to try to format if statements better based on contents while pretty printing.
2017-12-04Fix warnings in test suiteAlasdair Armstrong
2017-11-30Use doc_typdef_lem from experimentsAlasdair Armstrong
2017-11-30Merge branch 'master' into experimentsAlasdair Armstrong
2017-11-30Improvements to enable parsing and checking intermediate rewritingAlasdair Armstrong
steps Parser now has syntax for mutual recusion blocks mutual { ... fundefs ... } which is used for parsing and pretty printing DEF_internal_mutrec. It's stripped away by the initial_check, so the typechecker never sees DEF_internal_mutrec. Maybe this could change, as forcing mutual recursion to be explicit would probably be a good thing. Added record syntax to the new parser New option -dmagic_hash is similar to GHC's -XMagicHash in that it allows for identifiers to contain the special hash character, which is used to introduce new autogenerated variables in a way that doesn't clash with existing names. Option -sil compiles sail down to the intermediate language defined in sil.ott (not complete yet).
2017-11-29Better lem_ast tagging and interpreter tweaksAlasdair Armstrong
2017-11-29Switched to bytecode compiler for executing interpreter to avoid stack overflowAlasdair Armstrong
2017-11-29Fix lem_ast output bugsAlasdair Armstrong
2017-11-29Added location information for fixity and overloads in ast_util.mlAlasdair Armstrong
2017-11-28Make pretty printer able to print several internal constructs for debuggingAlasdair Armstrong