summaryrefslogtreecommitdiff
path: root/src/parser2.mly
AgeCommit message (Collapse)Author
2017-12-07Resolve function clause guard parsing ambiguity by requiring parenthesesBrian 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-05Better support for exceptions in sail for ASL specs that need them.Alasdair Armstrong
2017-12-05Update license headers for Sail sourceAlasdair 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-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-08Allow functions to be selectively declared external only for some backendsThomas Bauereiss
For example, val test = { ocaml: "test_ocaml" } : unit -> unit will only be external for OCaml. For other backends, it will have to be defined.
2017-11-08Allow for different extern names for different backendsAlasdair Armstrong
For example: val test = { ocaml: "test_ocaml", lem: "test_lem" } : unit -> unit val main : unit -> unit function main () = { test (); } for a backend not explicitly provided, the extern name would be simply "test" in this case, i.e. the string version of the id. Also fixed some bugs in the ocaml backend.
2017-11-02Fix a few AST and parsing-related bugsThomas Bauereiss
2017-10-24More succinct syntax in new parser for externed valspecs which shareAlasdair Armstrong
the same name between sail and the target
2017-10-13Repeat and while loops in menhir parser and pretty printerAlasdair Armstrong
2017-10-10More improvements to menhir parserAlasdair Armstrong
2017-10-10Fixes to menhir parser and pretty printerAlasdair Armstrong
2017-10-09Improvements to menhir pretty printer and ocaml backendAlasdair Armstrong
Menhir pretty printer can now print enough sail to be useful with ASL parser Fixity declarations are now preserved in the AST Menhir parser now runs without the Pre-lexer Ocaml backend now supports variant typedefs, as the machinery to generate arbitrary instances of variant types has been added to the -undefined_gen flag
2017-10-06Various improvements to menhir parser, and performance improvments for Z3 callsAlasdair Armstrong
New option -memo_z3 memoizes calls to the Z3 solver, and saves these results between calls to sail. This greatly increases the performance of sail when re-checking large specifications by about an order of magnitude. For example: time sail -no_effects prelude.sail aarch64_no_vector.sail real 0m4.391s user 0m0.856s sys 0m0.464s After running with -memo_z3 once, running again gives: time sail -memo_z3 -no_effects prelude.sail aarch64_no_vector.sail real 0m0.457s user 0m0.448s sys 0m0.008s Both the old and the new parser should now have better error messages where the location of the parse error is displayed visually in the error message and highlighted.
2017-10-04Fixed a bug in vector concatenation l-expressionsAlasdair Armstrong
The code for these is now rather ugly though... it needs to be cleaned up at some point Also various improvements to new menhir parser
2017-10-04Merge branch 'cleanup' into experimentsAlasdair Armstrong
2017-10-03Fixes to new parserAlasdair Armstrong
2017-09-21Refactored AST valspecs into single constructorAlasdair Armstrong
2017-09-21Change NC_fixed to NC_equal to match NC_not_equalAlasdair Armstrong
also rename NC_nat_set_bounded to NC_set (it was an int set not a nat set anyway)
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-13Work on improving Sail error messagesAlasdair Armstrong
- Modified how sail type error messages are displayed. The typechecker, rather than immediately outputing a string has a datatype for error types, which are the pretty-printed using a PPrint pretty-printer. Needs more work for all the error messages. - Error messages now attempt to highlight the part of the file where the error occurred, by printing the line the error is on and highlighting where the error message is in red. Again, this needs to be made more robust, especially when the error messages span multiple lines. Other things - Improved new parser and lexer. Made the lexer & parser handling of colons simpler and more intuitive. - Added some more typechecking test cases
2017-08-23Started work on an undefined literal removal pass for the ocamlAlasdair Armstrong
backed. Ocaml doesn't support undefined values, so we need a way to remove them from the specification in order to generate good ocaml code. There are more subtle issues to - like if we initialize a mutable variable with an undefined list, then the ocaml runtime has no way of telling what it's length should be (as this information is removed by the simple_types pass). We therefore rewrite undefined literals with calls to functions that create undefined types, e.g. (bool) undefined becomes undefined_bool () (vector<'n,'m,dec,bit>) undefined becomes undefined_vector(sizeof 'n, sizeof 'm, undefined_bit ()) We therefore have to generate undefined_X functions for any user defined datatype X. initial_check seems to be the logical place for this. This is straightforward provided the user defined types are not-recursive (and it shouldn't be too bad even if they are).
2017-08-16Added the feature to bind type variables in patterns.Alasdair Armstrong
The reason you want this is to do something like (note new parser only): ********* default Order dec type bits 'n:Int = vector('n - 1, 'n, dec, bit) val zeros : forall 'n. atom('n) -> bits('n) val decode : bool -> unit function decode b = { let 'datasize: {|32, 64|} = if b then 32 else 64; let imm: bits('datasize) = zeros(datasize); () } ********* for the ASL decode functions, where the typechecker now knows that the datasize variable and the length of imm are the same.
2017-08-15Menhir parser support for try/catchAlasdair Armstrong
2017-08-14More constructs in menhir parser, plus support for both left and right infix ↵Alasdair Armstrong
operators.
2017-08-10Improved operator support for test menhir parserAlasdair Armstrong
2017-08-10Experimenting with alternate parserAlasdair Armstrong
2017-08-08Add infrastructure to play with new menhir parsers.Alasdair Armstrong
Added a copy of the current parser/lexer in parser2.mly and lexer2.mll. They can be used with the -new_parser flag. Currently they are just copies of the existing files.