diff options
| author | Alasdair Armstrong | 2019-02-05 20:52:03 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2019-02-05 20:52:03 +0000 |
| commit | 18d9a16b1cfd442fb05039a326795bcd64cb6a79 (patch) | |
| tree | 7308ad6d405d43acff0e743310f2e4b21f2f0684 /editors | |
| parent | 078e0bb639e89d82e2bccd2e1f5c382409869ff7 (diff) | |
Simpler implicit arguments
Rather than using sizeof-rewriting which is slow and error-prone, just
make implicit function arguments explicit, so:
val ZeroExtend : forall 'n 'm, 'm >= 'n. (implicit('m), bits('n)) -> bits('m)
let x : bits(32) = ZeroExtend(0xFFFF)
would be re-written (by the typechecker itself) into
val ZeroExtend : forall 'n 'm, 'm >= 'n. (implicit('m), bits('n)) -> bits('m)
let x : bits(32) = ZeroExtend(32, 0xFFFF)
then all we need to do is map implicit -> int in a rewrite, and use
trivial sizeof-rewriting only. We pretty much never want to use the
form of sizeof-rewriting that propagates function arguments through
multiple functions because it's extremely error-prone. Anything that
isn't re-writable via trivial sizeof rewriting should be a type error,
so it would be good to re-write sizeof expressions within the
type-checker.
Diffstat (limited to 'editors')
| -rw-r--r-- | editors/sail-mode.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/sail-mode.el b/editors/sail-mode.el index b1adccaf..25181fea 100644 --- a/editors/sail-mode.el +++ b/editors/sail-mode.el @@ -30,7 +30,7 @@ "overload" "cast" "sizeof" "constant" "constraint" "default" "assert" "newtype" "from" "pure" "infixl" "infixr" "infix" "scattered" "end" "try" "catch" "and" "to" "throw" "clause" "as" "repeat" "until" "while" "do" "foreach" "bitfield" - "mapping" "where" "with")) + "mapping" "where" "with" "implicit")) (defconst sail2-kinds '("Int" "Type" "Order" "Bool" "inc" "dec" |
