summaryrefslogtreecommitdiff
path: root/src/pretty_print_ocaml.ml
AgeCommit message (Collapse)Author
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-11-16Remove unused Typ_wild 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-08-15Removed Typ_arg_effect - nobody used it and it isn't supported by the backends.Alasdair Armstrong
2017-08-02Improve pretty-printing of register declaration and assignmentThomas Bauereiss
2017-08-01Add missing lexp case to Ocaml pretty-printerThomas Bauereiss
2017-07-27Add cons patterns to pretty-printersThomas Bauereiss
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-21Pretty-print bitvector expressionsThomas Bauereiss
- Add case distinctions between bitvector types and vectors of other element types (e.g. registers) and use the corresponding operations (i.e. "bvslice", "bvaccess", etc for the former, and "slice", "access", etc for the latter) when pretty-printing expressions - Add type annotations to expressions when the type includes bitvectors with concretely known length - Update state.lem to use bitvectors (in the interface, at least; internally, bitvectors are still stored as bit lists for now, since that makes it easier to support storing different registers with different lengths) This has been tested with the CHERI-MIPS model with some success, but some things are still missing: - Bitvector patterns are not handled yet - Some bitvector length monomorphisation is needed in a few places of the model - Some type annotations are missing, because the (old) Sail type checker does not infer bitvector lengths in some instances where one would hope it to do that; this should be checked with the new type checker
2017-05-08add some missing things in sail_values and make big_int version the default ↵Robert Norton
for set_vector_subrange_bit.
2017-05-08add error messages for unhandled pattern match nodes in ocaml pretty printer.Robert Norton
2017-05-08put failwith in brackets to avoid parse error.Robert Norton
2017-04-21define some big_int literals in sail_values.ml to avoid lots of calls to ↵Robert Norton
bit_int_of_int. Likely very little performance benefit but slightly more readable.
2017-04-20add brackets around integer literals so that ocaml parses them correctly and ↵Robert Norton
doesn't mistake the - for minus operator
2017-04-20add missing KD_nabbrev support in ocaml shallow embedding.Robert Norton
2017-04-20support assert in ocaml shallow embedding.Robert Norton
2017-04-20use mangled field name when accessing record field.Robert Norton
2017-04-20add name to register representation and print it on write.Robert Norton
2017-04-18make ocaml embedding of foreach use (now universal) big_ints.Robert Norton
2017-04-18Implement return using an exception caught in the function body. Polymorphic ↵Robert Norton
exceptions are not permitted so a local mutable variable, ret, is used in ocaml to store the return value. This avoids having to define a new exception type for each function. Ocaml infers the type of the option when it is assigned at the return site.
2017-04-18Generate runtime error for L_undef. Existing code was broken except for type ↵Robert Norton
bit (specifically it caused generated ocaml to fail to type check for an undef number.
2017-04-07fix error in generated ocaml where writing single bit of register was not ↵Robert Norton
taking account of register direction.
2017-04-06use set_register when writing element of vector of registers to avoid ↵Robert Norton
accidentally replacing Vregister with Vvalue or Vregister... Seems to work for MIPS but not sure if might encounter vector of something other than bit or register. A more specific value type would have made this a compile-time error rather than run-time.
2017-03-29Factor out pretty printers into separate files. Hopefully this will make ↵Robert Norton
searching easier.