Commit Graph
72 Commits
Author SHA1 Message Date
Nigel Tao 86c6b79e1a Handle structs that contain structs. 2017-06-15 15:19:41 +10:00
Nigel Tao 019e83f190 Add lzw_decoder.set_literal_width. 2017-06-11 14:02:05 +10:00
Nigel Tao 321ebf8617 Unexport check.TypeExprFoo variables. 2017-06-10 12:16:29 +10:00
Nigel Tao 793eb043a4 Bounds check intermediate expressions.
When checking "(a + b) * 0", "a + b" might still overflow.
2017-06-10 11:41:20 +10:00
Nigel Tao ebf3713555 Rename PackageOrDecorator to Decorator. 2017-06-10 10:55:51 +10:00
Nigel Tao f5af981f15 Generate C code for "in.dst.write_u8?(x:foo)". 2017-06-09 16:41:59 +10:00
Nigel Tao 3863427127 Add user-defined error and status codes. 2017-06-09 12:26:00 +10:00
Nigel Tao 6e7e566232 Rename token.IDMap to token.Map. 2017-06-08 13:10:01 +10:00
Nigel Tao da133c02ce Add FlagsCallImpure and FlagsCallSuspendible. 2017-06-03 13:34:19 +10:00
Nigel Tao 1758637f89 Generate a C placeholder for "in.src.read_u8?()". 2017-06-03 12:25:31 +10:00
Nigel Tao 3f5bb7a02b Check a while loop's pre and inv conditions. 2017-06-01 17:11:01 +10:00
Nigel Tao bcf6a7ee1d Generate C break's and continue's. 2017-06-01 15:25:01 +10:00
Nigel Tao 2ed019b670 Add "while:label" and "break:label" syntax. 2017-06-01 13:53:27 +10:00
Nigel Tao 47da01233b Use "inv etc" not "assert etc" for invariants. 2017-06-01 11:37:29 +10:00
Nigel Tao 5d0b664ccf Generate C function bodies. 2017-05-28 17:17:00 +10:00
Nigel Tao ca78c343cb Generate C local variables. 2017-05-28 14:36:42 +10:00
Nigel Tao 99ff8e2487 Let fields have default values. 2017-05-28 13:47:29 +10:00
Nigel Tao c437bf258e Parse "pub" and "pri". 2017-05-27 11:02:01 +10:00
Nigel Tao 849f885993 Parse the "!" in "foo!()", meaning impure. 2017-05-27 10:38:19 +10:00
Nigel Tao d5d6447ce5 Check assertions on while loop exit. 2017-05-20 17:05:38 +10:00
Nigel Tao 9184e2682e Use "T[..inclMax]" instead of "T[:exclMax]". 2017-05-20 15:11:30 +10:00
Nigel Tao d323440511 Rename some "m, n, o" variables for consistency. 2017-05-20 12:58:36 +10:00
Nigel Tao 06eaadb1d6 Add via keyword and named args. 2017-05-19 16:14:05 +10:00
Nigel Tao 90c5f4758e Add Token.KeyFoo constants. 2017-05-18 16:04:26 +10:00
Nigel Tao a8c304236d First cut of a bounds checker. 2017-05-18 13:37:46 +10:00
Nigel Tao 15485dadc1 Add ast.FlagsTypeChecked. 2017-05-18 11:03:56 +10:00
Nigel Tao d9fc8a1114 Merge Break and Continue as Jump. 2017-05-14 11:45:58 +10:00
Nigel Tao 23020e7d60 Make the "true" in "while true { etc }" mandatory. 2017-05-14 11:38:10 +10:00
Nigel Tao 1d3ae23418 Introduce "pre" and "post" asserts. 2017-05-14 11:27:46 +10:00
Nigel Tao 27b33b77df Rename ast.Param to ast.Field. 2017-05-13 16:14:42 +10:00
Nigel Tao 85f3cca0cd Name the func's "in" and "out" params.
This eliminates one []*Node typed field from the Node struct.
2017-05-13 16:07:25 +10:00
Nigel Tao e87ff7163b Change the "for" keyword to "while".
The semantics is closer to C's "while". Also, "while" is simpler, which
means simpler interactions with assertions, pre- and post-conditions.
2017-05-13 14:31:52 +10:00
Nigel Tao ebef5d6999 Refactor the ast Eq code. 2017-05-13 10:42:51 +10:00
Nigel Tao 7367a382b2 Check "i < j" when i's type refines j's type. 2017-05-13 10:40:48 +10:00
Nigel Tao c3c600627b Check that every Expr has an MType. 2017-05-13 10:14:03 +10:00
Nigel Tao 8dd151bf74 Set a unary op expr's const value. 2017-05-12 16:29:32 +10:00
Nigel Tao 0e59b05432 Check "b = not true". 2017-05-12 16:03:35 +10:00
Nigel Tao 188f0e9e3b Check "x = 0". 2017-05-12 15:18:38 +10:00
Nigel Tao 1dd51ac30f Implement Expr.String. 2017-05-12 13:22:27 +10:00
Nigel Tao d92049b8fa Parse "f(x)(y)". 2017-05-12 13:18:54 +10:00
Nigel Tao ede8786f4b Reject "x = y" if their types don't match. 2017-05-12 11:53:27 +10:00
Nigel Tao d8d17b66c0 Make {Type,}ExprString methods, not functions. 2017-05-12 10:59:10 +10:00
Nigel Tao c1ce1b08de Check "var z u64[:123]". 2017-05-11 17:11:17 +10:00
Nigel Tao c3d9ea2aa6 Fix ast.Assert typo. 2017-05-11 16:23:19 +10:00
Nigel Tao 4a4c6375c0 Tighten an ast.TypeExpr's types. 2017-05-11 16:05:34 +10:00
Nigel Tao 9f226d00e0 Rename Expr.List to Expr.Args. 2017-05-11 15:57:17 +10:00
Nigel Tao 50a039f24c Re-organize some comments. 2017-05-11 15:55:28 +10:00
Nigel Tao e1c890907e Add type-safe wrappers for *ast.Node.
This means that code that uses nodes shouldn't have to fiddle with ID0,
LHS, List0 etc fields directly.
2017-05-11 15:32:02 +10:00
Nigel Tao 56de3228e1 Introduce explicit "var x T" syntax.
This makes type checking easier and more explicit.
2017-05-07 09:00:36 +10:00
Nigel Tao f744089e9c First cut of a type checker. 2017-05-06 16:55:17 +10:00