Nigel Tao
7a3ddbc025
Add a "limit" keyword.
2017-06-22 17:32:56 +10:00
Nigel Tao
1a42706bf1
Add a reader1.skip32 method.
2017-06-22 13:09:53 +10:00
Nigel Tao
07e96d7055
Pack token disambiguation keys a little tighter.
2017-06-22 11:33:24 +10:00
Nigel Tao
17e47fbc1e
Add reader1 and writer1 base types.
2017-06-18 11:50:34 +10:00
Nigel Tao
f4db300358
Support "0x123" hexadecimal numeric literals.
2017-06-16 11:57:02 +10:00
Nigel Tao
f403d0faa8
Generate C code for "in.dst.write?(etc)".
2017-06-10 17:28:35 +10:00
Nigel Tao
3863427127
Add user-defined error and status codes.
2017-06-09 12:26:00 +10:00
Nigel Tao
a81752647c
Generate C code for "x.low_bits(n:y)".
2017-06-08 15:49:52 +10:00
Nigel Tao
0aa6a0f1c2
Don't reserve "ideal" as a keyword.
...
Use "ℤ" instead, which can never conflict with user-defined identifiers,
as it is non-ASCII, but also the mathematical meaning of "ℤ" perfectly
captures the concept of an ideal integer type.
2017-06-08 14:01:52 +10:00
Nigel Tao
cf41f0406b
Add an nptr keyword.
...
This just changes the tokenizer. Changing the parser, checker, code
generator, etc. are future changes.
2017-06-08 13:12:43 +10:00
Nigel Tao
6e7e566232
Rename token.IDMap to token.Map.
2017-06-08 13:10:01 +10:00
Nigel Tao
0646f4472c
Add built-in token.IDs for "read_u8" etc.
2017-06-03 11:15:34 +10:00
Nigel Tao
db41d789a5
Generate C code for "x as T".
2017-06-03 10:24:52 +10:00
Nigel Tao
5a0aea66a3
Bounds check "x >> y".
2017-06-02 10:57:56 +10:00
Nigel Tao
a0a9975815
Add a built-in token.ID for the 0 literal.
2017-06-01 21:33:51 +10:00
Nigel Tao
47da01233b
Use "inv etc" not "assert etc" for invariants.
2017-06-01 11:37: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
7df75101cd
Simplify tokenization of multi-byte squiggles.
2017-05-21 10:56:21 +10:00
Nigel Tao
9184e2682e
Use "T[..inclMax]" instead of "T[:exclMax]".
2017-05-20 15:11:30 +10:00
Nigel Tao
06eaadb1d6
Add via keyword and named args.
2017-05-19 16:14:05 +10:00
Nigel Tao
f713bb9a21
Bounds check "x += y".
2017-05-19 11:34:44 +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
1d3ae23418
Introduce "pre" and "post" asserts.
2017-05-14 11:27:46 +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
f7095028f0
Check struct declarations.
2017-05-13 15:36:37 +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
bd5f222fb6
Check "x = 1 + 2".
2017-05-12 18:50:20 +10:00
Nigel Tao
c1ce1b08de
Check "var z u64[:123]".
2017-05-11 17:11:17 +10:00
Nigel Tao
a8a246be7c
Reserve the "ideal" name.
...
Also reject using built-in names as struct or func names.
2017-05-11 15:45:33 +10:00
Nigel Tao
54567dbd47
Rename ParseFile, RenderFile to Parse, Render.
...
Also make various funcs' arg order consist wrt the IDMap and the input
or inputs.
2017-05-11 09:48:01 +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
98352c2f07
Add a Checker.Funcs method.
2017-05-06 18:09:37 +10:00
Nigel Tao
cf8167a648
Add ByID and ByToken to token.IDMap.
2017-05-06 17:02:11 +10:00
Nigel Tao
f744089e9c
First cut of a type checker.
2017-05-06 16:55:17 +10:00
Nigel Tao
6424985f0f
Export token Key and Flags bit sizes.
2017-05-06 14:20:18 +10:00
Nigel Tao
9fe975213b
Disambiguate unary vs binary plus' token.IDs.
2017-05-05 16:15:11 +10:00
Nigel Tao
60a4fdb9fd
Parse use "std/io".
2017-05-05 15:07:30 +10:00
Nigel Tao
65d6608434
Parse "struct foo(x u32)".
...
Also remove an obsolete TODO comment.
2017-05-05 13:51:09 +10:00
Nigel Tao
94cb8b25cb
Tokenize and render comments.
2017-05-05 12:33:38 +10:00
Nigel Tao
9f5ddd4d99
Parse "f?(x)".
...
Also fix some FlagsAssociative token flags.
2017-05-04 19:04:07 +10:00
Nigel Tao
2045b1a9d4
Parse break, continue and return.
2017-05-04 18:39:47 +10:00
Nigel Tao
14ec9e33b7
Parse if statements.
2017-05-04 18:28:03 +10:00
Nigel Tao
4164fe2504
Parse for loops.
2017-05-04 18:02:57 +10:00
Nigel Tao
17c6c71e53
Parse "assert x < y".
2017-05-04 17:55:53 +10:00
Nigel Tao
17607c74a5
Parse "u32[:4096]".
2017-05-04 16:47:45 +10:00
Nigel Tao
8a7dee5a4d
Parse "f(i)".
2017-05-04 15:12:02 +10:00
Nigel Tao
2ff25dc122
Parse "x + y".
2017-05-04 13:45:33 +10:00
Nigel Tao
8dbc476375
Parse a "ptr T" type.
2017-05-04 12:44:06 +10:00