summaryrefslogtreecommitdiff
path: root/src/spec_analysis.ml
AgeCommit message (Collapse)Author
2018-03-12ELF loading for C backendAlasdair Armstrong
Add a flag to Sail that allows for an image of an elf file to be dumped in a simple format using linksem, used as sail -elf test.elf -o test.bin This image file can then be used by a compiled C version of a sail spec as with ocaml simply by ./a.out test.bin
2018-03-07Make union types consistent in the ASTAlasdair Armstrong
Previously union types could have no-argument constructors, for example the option type was previously: union option ('a : Type) = { Some : 'a, None } Now every union constructor must have a type, so option becomes: union option ('a : Type) = { Some : 'a, None : unit } The reason for this is because previously these two different types of constructors where very different in the AST, constructors with arguments were used the E_app AST node, and no-argument constructors used the E_id node. This was particularly awkward, because it meant that E_id nodes could have polymorphic types, i.e. every E_id node that was also a union constructor had to be annotated with a type quantifier, in constrast with all other identifiers that have unquantified types. This became an issue when monomorphising types, because the machinery for figuring out function instantiations can't be applied to identifier nodes. The same story occurs in patterns, where previously unions were split across P_id and P_app nodes - now the P_app node alone is used solely for unions. This is a breaking change because it changes the syntax for union constructors - where as previously option was matched as: function is_none opt = match opt { Some(_) => false, None => true } it is now matched as function is_none opt = match opt { Some(_) => false, None() => true } note that constructor() is syntactic sugar for constructor(()), i.e. a one argument constructor with unit as it's value. This is exactly the same as for functions where a unit-function can be called as f() and not as f(()). (This commit also makes exit() work consistently in the same way) An attempt to pattern match a variable with the same name as a union-constructor now gives an error as a way to guard against mistakes made because of this change. There is probably an argument for supporting the old syntax via some syntactic sugar, as it is slightly prettier that way, but for now I have chosen to keep the implementation as simple as possible. The RISCV spec, ARM spec, and tests have been updated to account for this change. Furthermore the option type can now be included from $SAIL_DIR/lib/ using $include <option.sail>
2018-01-18Merge remote-tracking branch 'origin/experiments' into sail2Alasdair Armstrong
2018-01-17Rewrite topological sortingThomas Bauereiss
Use Tarjan's algorithm for finding strongly connected components (and finding a topological sorting of components at the same time), in order to properly take into account mutually recursive functions. The sorting is stable, i.e., definitions are only moved when necessary. Exceptions to this are statements that do not have any dependencies: default bitvector order declarations, operator fixity declarations, and top-level comments. These are moved to the beginning (like with the previous sorting implementation). Any dependency cycles that are found are additionally printed to the console in dot-format, for easy visualisation with graphviz.
2018-01-12OCaml interactive mode can now run full aarch64 examples, and ocaml test cases.Alasdair Armstrong
2018-01-05Moved parser, lexer and pretty printer to correct locations.Alasdair Armstrong
2018-01-05Added bitfield syntax to replicate register bits typeAlasdair Armstrong
For example: bitfield cr : vector(8, dec, bit) = { CR0 : 7 .. 4, LT : 7, CR1 : 3 .. 2, CR2 : 1, CR3 : 0, } The difference this creates a newtype wrapper around the vector type, then generates getters and setters for all the fields once, rather than having to handle this construct separately in every backend.
2018-01-02Experimenting with power specAlasdair Armstrong
2017-12-14Fix all compiler warning except in lem pretty printer and monomorphisationAlasdair Armstrong
2017-12-13Use big_nums from LemAlasdair Armstrong
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-05Update license headers for Sail sourceAlasdair Armstrong
2017-11-16Remove unused Typ_wild constructorAlasdair Armstrong
2017-10-31Fix bug in topological sorting of val-specsThomas Bauereiss
Put them before the function they declare
2017-10-25Allow mutually recursive functionsThomas Bauereiss
2017-10-24Remove special case for boolean (as opposed to bool)Brian Campbell
2017-10-19Follow AST changes in (Lem) pretty-printersThomas Bauereiss
2017-09-21Refactored AST valspecs into single constructorAlasdair Armstrong
2017-09-21Remove unused kind_def (KD_) nodes from ASTAlasdair Armstrong
2017-09-21Simplify AST by removing LB_val_explicit and replace LB_val_implicit with ↵Alasdair Armstrong
just LB_val in AST also rename functions in rewriter.ml appropriately.
2017-09-21Cleaning up the AST and removing redundant and/or unused nodesAlasdair Armstrong
2017-09-14Fix bug in topological sortingThomas Bauereiss
2017-08-14Existentials in free type var functionsBrian Campbell
2017-08-01Modified the typechecker for ASL generationAlasdair Armstrong
2017-07-27Add cons patterns to pretty-printersThomas Bauereiss
2017-07-21Switch to new typechecker (almost)Thomas Bauereiss
Initial typecheck still uses previous typechecker
2017-02-03fix headersPeter Sewell
2016-10-13make sail-to-lem rewriting passes use dependency analysis, make dependency ↵Christopher Pulte
analysis include type information, small pp fix
2016-10-12Add free variable and dependency sorting functions, lifted from internal to ↵Kathy Gray
external repository
2016-01-21Start splitting values/etc into int/big_int for ocaml generationKathy Gray
2016-01-19Put None and Some into interpreter environmentsKathy Gray
Also making progress towards separating int sized things from integer sized things
2015-11-10Make first half of sequential interpreter driver compile againKathy Gray
2015-11-06fixesChristopher Pulte
2015-11-04Add a new module for writing queries/analyses that aren't type checking but ↵Kathy Gray
could be useful Define in that a function for determining a default direction for vectors