summaryrefslogtreecommitdiff
path: root/src/pretty_print.mli
AgeCommit message (Collapse)Author
2020-09-28Refactor: Rename 'a defs to 'a astAlasdair
Change internal terminology so we more clearly distinguish between a list of definitions 'defs' and functions that take an entire abstract syntax trees 'ast'.
2020-09-28Move the ast defs wrapper into it's own fileAlasdair
This refactoring is intended to allow this type to have more than just a list of definitions in future.
2019-01-17Work around an issue with type abbreviations in HOLThomas Bauereiss
If we use the bitlist representation of bitvectors, the type argument in type abbreviations such as "bits('n)" becomes dead, which confuses HOL; as a workaround, expand type synonyms in this case.
2018-07-25Remove unused internal AST nodesAlasdair Armstrong
E_internal_cast, E_sizeof_internal, E_internal_exp, E_internal_exp_user, E_comment, and E_comment_struc were all unused. For a lem based interpreter, we want to be able to compile it to iUsabelle, and due to slowness inherent in Isabelle's datatype package we want to remove unused constructors in our AST type. Also remove the lem_ast backend - it's heavily bitrotted, and for loading the ARM ast into the interpreter it's just not viable to use this approach as it just doesn't scale. We really need a way to be able to serialise and deserialise the AST efficiently in Lem.
2018-01-12Merge remote-tracking branch 'origin/experiments' into sail2Alasdair Armstrong
2018-01-05Removed legacy parser/lexer and pretty printerAlasdair Armstrong
2017-12-14Make sequential and mwords global variables in Lem pretty-printerThomas Bauereiss
2017-12-05Update license headers for Sail sourceAlasdair Armstrong
2017-11-24Use unbound precision big_ints throughout sail.Alasdair Armstrong
Alastair's test cases revealed that using regular ints causes issues throughout sail, where all kinds of things can internally overflow in edge cases. This either causes crashes (e.g. int_of_string fails for big ints) or bizarre inexplicable behaviour. This patch switches the sail AST to use big_int rather than int, and updates everything accordingly. This touches everything and there may be bugs where I mistranslated things, and also n = m will still typecheck with big_ints but fail at runtime (ocaml seems to have decided that static typing is unnecessary for equality...), as it needs to be changed to eq_big_int. I also got rid of the old unused ocaml backend while I was updating things, so as to not have to fix it.
2017-08-24Begin refactoring Sail libraryThomas Bauereiss
- Add back support for bit list representation of bit vectors, for backwards compatibility in order to ease integration with the interpreter. For this purpose, split out a file sail_operators.lem from sail_values.lem, and add a variant sail_operators_mwords.lem for the machine word representation of bitvectors. Currently, Sail is hardcoded to use machine words for the sequential state monad, and bit lists for the free monad, but this could be turned into a command line flag. - Add a prelude_wrappers.sail file for glueing the Sail prelude to the Lem library. The wrappers make use of sizeof expressions to extract type information from bitvectors (length, start index) in order to pass it to the Lem functions. - Add early return support to the free monad, using a new constructor "Return of 'r". As with the sequential monad, functions with early return are wrapped into "catch_early_return", which extracts the return value at the end of the function execution.
2017-08-17Add support for register types other than bitvector to state monadThomas Bauereiss
Make state monad parametric in register state, and generate a record with registers from the Sail spec
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-21Switch to new typechecker (almost)Thomas Bauereiss
Initial typecheck still uses previous typechecker
2017-06-29Various improvements to typecheckerAlasdair Armstrong
Added vector concatenation patterns. Currently slightly more restrictive than before as each subvector's length must be inferrable from just that particular subvector - this may require additional type annotations in certain vector patterns. How exactly weird vector patterns, such as incrementing and decrementing vectors appearing in the same pattern, as well as patterns with funny start indexes should be dealt with correctly is unclear. It's probably best to be as restrictive as possible to avoid unsoundness bugs. Added a new option -ddump_tc_ast which dumps the (new) typechecked AST to stdout. Also added a new option -dno_cast which disables implicit casting in the typechecker. These options can be used in conjunction to dump the typechecked ast (which has all implicit casts resolved), and then re-typecheck it as a way to check that the typechecker is indeed resolving all casts correctly, and is reconstructing a fully type correct AST. The run_tests.sh script in test/typecheck has been modified to do this. Removed the dependency on Type_internal.ml from pretty_print_sail.ml. This means that we can no longer pretty print certain internal constructs produced by the old typechecker, but on the plus side it means that the sail pretty printer is type system agnostic and works with any annotation AST, irregardless of the type of annotations. Also fixed a few bugs where certain constructs would be pretty printed incorrectly.
2017-02-03fix headersPeter Sewell
2017-01-31Kathy, Peter: pp of initial type environmentPeter Sewell
2016-11-28make sail produce prompt and state version of shallow embedding files at the ↵Christopher Pulte
same time with the types both have in common factored out into separate file, rename one mips shallow embedding _extras file as required by this
2016-10-11move armv8_extras and power_extras to idl/power and idlarm, fixesChristopher Pulte
2015-10-28progress on lem backend: auto-generate read_register and write_register ↵Christopher Pulte
functions, and state definition
2015-10-26add preliminary Sail_values.lem, adapt lem pp to recent Ocaml pp changesChristopher Pulte
2015-09-28basic untested ocaml boiler plateKathy Gray
2015-06-10Put missing cases into nexp_eq_checkKathy Gray
2014-05-15Make pp_exp export to bufferGabriel Kerneis
2014-05-15Pretty-print to stdout rather than Format.stdout_formatterGabriel Kerneis
PPrint.ToFormatter is either broken, or I do not know how to use it properly. Switching to ToChannel solves the issue nicely.
2014-02-07Correct variable-name bug that was throwing away type checking coercions and ↵Kathy Gray
type annotations
2013-09-09Pretty printer to Lem ast added; accessed by -lem_ast on the command lineKathy Gray
2013-08-22Pretty printer for whole AST; due to parenthesis not always being placed ↵Kathy Gray
where needed, what is generated may not parse
2013-08-20more support for pretty printingKathy Gray
2013-08-20Set some initial kind environments; start pretty printingKathy Gray