summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-07-24Remove monomorphisation for old type checkerBrian Campbell
2017-07-24Tidy comments in monomorphisationBrian Campbell
2017-07-21Everything moved to new typecheckerAlasdair Armstrong
Modified initial_check.ml so it no longer requires type_internal. It's still needs cleaned up in a few ways. Most of the things it's trying to do could be done nicer if we took some time to re-factor it, and some of the things should just be handled by the main typechecker, leaving it as a think layer between the parse_ast and the ast. Now that's done everything can be switched to the new typechecker and the _new suffixes were deleted from everything except the monomorphisation pass because I don't know the status of that.
2017-07-21Add a prove builtin that allows testing flow typingAlasdair Armstrong
For example: default Order dec val bit[64] -> unit effect pure test64 val cast forall 'n, 'n = 32 | 'n = 64. bit['n] -> unit effect pure test function forall 'n. unit test addr = { _prove(constraint('n != 16)); assert(constraint('n = 64), "64-bit mode"); _prove(constraint('n = 64)); test64(addr); } This doesn't affect the AST at all as _prove is just a ordinary function that the typechecker treats specially.
2017-07-21Merge branch 'sail_new_tc' of https://bitbucket.org/Peter_Sewell/sail into ↵Alasdair Armstrong
sail_new_tc
2017-07-21Improvements to sail n_constraintsAlasdair Armstrong
1) Added a new construct to the expression level: constraint. This is the essentially the boolean form of sizeof. Whereas sizeof takes a nexp and has type [:'n:], constraint takes a n_constraint and returns a boolean. The hope is this will allow for flow typing to be represented more explicitly in the generatated sail from ASL. For example we could have something like: default Order dec val bit[64] -> unit effect pure test64 val forall 'n, ('n = 32 | 'n = 64 | 'n = 10) & 'n != 43. bit['n] -> unit effect pure test function forall 'n. unit test addr = { if constraint('n = 32) then { () } else { assert(constraint('n = 64), "64-bit mode"); test64(addr) } } 2) The other thing this example demonstrates is that flow constraints now work with assert and not just if. Even though flow typing will only guarantee us that 'n != 32 in the else branch, the assert gives us 'n = 64. This is very useful as it's a common idiom in the ARM spec to guarantee such things with an assert. 3) Added != to the n_constraint language 4) Changed the n_constraint language to add or and and as constructs in constraints. Previously one could have a list of conjuncts each of which were simple inequalites or set constraints, now one can do for example: val forall 'n, ('n = 32 | 'n = 64) & 'n in {32, 64}. bit['n] -> unit effect pure test This has the very nice upside that every n_constraint can now be negatated when flow-typing if statements. Note also that 'in' has been introduced as a synonym for 'IN' in the constraint 'n in {32,64}. The use of a block capital keyword was a bit odd there because all the other keywords are lowercase.
2017-07-21Switch to new typechecker (almost)Thomas Bauereiss
Initial typecheck still uses previous typechecker
2017-07-21Fix more corner casesThomas Bauereiss
2017-07-21Fix type synonyms in monomorphisationBrian Campbell
2017-07-20Clean up some failwithsBrian Campbell
2017-07-20Tidy up id handling in monomorphisationBrian Campbell
2017-07-20Handle guarded patterns in monomorphisationBrian Campbell
2017-07-19Better pretty printing for sail functions with no inline type annotationsAlasdair Armstrong
Also added some additional helper functions in type_check_new.mli and changed real literals slightly
2017-07-18Add Lem pretty-printer for new typecheckerThomas Bauereiss
2017-07-18Added pretty-printing support for real literalsAlasdair Armstrong
2017-07-18Added real number literals to sail, to better support full ASL translationAlasdair Armstrong
2017-07-17Added pattern guards to sailAlasdair Armstrong
Introduces a when keyword for case statements, as the Pat_when constructor for pexp's in the AST. This allows us to write things like: typedef T = const union { int C1; int C2 } function int test ((int) x, (T) y) = switch y { case (C1(z)) when z == 0 -> 0 case (C1(z)) when z != 0 -> x quot z case (C2(z)) -> z } this should make translation from ASL's patterns much more straightforward
2017-07-17Fix some corner casesThomas Bauereiss
2017-07-15Add version of rewriter for new typecheckerThomas Bauereiss
2017-07-14Extend literal matching in monomorphisationBrian Campbell
2017-07-14Generalise matching a little in monomorphisationBrian Campbell
2017-07-13Avoid recent OCaml library functionBrian Campbell
2017-07-13Added some code to check if function return types in function clauses and ↵Alasdair Armstrong
val specs are the same
2017-07-13Monomorphisation size limitsBrian Campbell
2017-07-13Monomorphisation now splits vectorsBrian Campbell
2017-07-13Make new-tc monomorphisation actually workBrian Campbell
2017-07-13Couple of fixes for old-tc monomorphisationBrian Campbell
2017-07-13Add basic translation of monomorphisation to the new type checkerBrian Campbell
2017-07-13Typechecker now inserts val specs into AST when it infers themAlasdair Armstrong
2017-07-13Modified MIPS model so it typechecks with the new typecheckerAlasdair Armstrong
2017-07-13Improved type inference for let statements and assignments with type ↵Alasdair Armstrong
annotated patterns and lexps Added get_enum to type checker interface
2017-07-12Various small changesAlasdair Armstrong
* Experimented with using list<bit> to clean up manually monomorphised code in MIPS tlb * Added option -dtc_verbose to control verbosity of new typechecker * Allowed functions with val specs to omit their type declarations
2017-07-12Remove old interface fileBrian Campbell
2017-07-12Merge branch 'sail_new_tc' of https://bitbucket.org/Peter_Sewell/sail into ↵Alasdair Armstrong
sail_new_tc
2017-07-12Removed inital_check_full_astAlasdair Armstrong
2017-07-12Fixed parser to parse 2** nexp expressions properlyAlasdair Armstrong
This introduces some shift/reduce and reduce/reduce conflicts, but I don't think these matter.
2017-07-12Add annotations to raw bitvector slicesThomas Bauereiss
2017-07-12MergeThomas Bauereiss
2017-07-12Add checks for variable identifiers in pattern subsumptionThomas Bauereiss
2017-07-12Added vector range l-expressions and additional testsAlasdair Armstrong
2017-07-11Merge branch 'sail_new_tc' of https://bitbucket.org/Peter_Sewell/sail into ↵Alasdair Armstrong
sail_new_tc
2017-07-11Various typechecker improvements:Alasdair Armstrong
* Fixed a bug where non-polymorphic function return types could be incorrect * Added support for LEXP_memory AST node * Flow typing constraint generation for all inequality operators * Better support for increasing vector indices in field access expressions
2017-07-11Fix missing vector append constraints in old type checkerBrian Campbell
2017-07-10Bugfixes and testing new checker on the MIPS specAlasdair Armstrong
2017-07-10Added tests for union constructor matchingAlasdair Armstrong
2017-07-10Merge remote-tracking branch 'origin/word' into sail_new_tcAlasdair Armstrong
2017-07-10Adder pattern matching for union typesAlasdair Armstrong
2017-07-10Further performance improvements to typecheckerAlasdair Armstrong
Added code to solve basic constraints without passing them to Z3. This results in roughly another 5x speedup.
2017-07-10Performance improvements to type checkerAlasdair Armstrong
Filter the possible casts by only attempting those which reasonably match the surrounding type environment. This results in about a 5x performance improvement.
2017-07-10Reduce functions during constant propagation under reasonable circumstancesBrian Campbell