Commit Graph

13 Commits

Author SHA1 Message Date
Isaac Freund
abd1c75c4a stage1: disallow 1.e9 and 0x1.p9 as float literals 2021-05-31 19:51:11 +00:00
Andrew Kelley
f5d4fe3e17 stage1: memoize strings in the AST
Currently, stage1 runs astgen for every comptime function call,
resulting in identifier strings being allocated multiple times,
wasting memory. As a workaround until the code is adjusted to
make astgen run only once per source node, we memoize the
result into the AST.

 * Rename `ir_gen_*` to `astgen_*`
   - Oops, meant to do this in a separate commit. My bad.
 * tokenizer: avoid using designated initializer syntax.
   MSVC does not support it.
2021-05-28 15:22:03 -07:00
Andrew Kelley
52b3daa90e stage1: get test-compile-errors passing again 2021-05-28 14:19:08 -07:00
Andrew Kelley
9de2c1b76e stage1: tokenizer: backport recent stage2 changes
This backports ec10595b65 stage2 tokenizer
logic to stage1.
2021-05-28 13:26:16 -07:00
Andrew Kelley
2a990d6966 stage1: rework tokenizer to match stage2
* Extracts AstGen logic from ir.cpp into astgen.cpp. Reduces the
   largest file of stage1 from 33,551 lines to 25,510.
 * tokenizer: rework it completely to match the stage2 tokenizer logic.
   They can now be maintained together; when one is changed, the other
   can be changed in the same way.
   - Each token now takes up 13 bytes instead of 64 bytes. The tokenizer
     does not parse char literals, string literals, integer literals,
     etc into meaningful data. Instead, that happens during parsing or
     astgen.
   - no longer store line offsets. Error messages scan source
     files to find the line/column as needed (same as stage2).
   - main loop: instead of checking the loop, handle a null byte
     explicitly in the switch statements. This is a nice improvement
     that we may want to backport to stage2.
   - delete some dead tokens, artifacts of past syntax that no longer
     exists.
 * Parser: fix a TODO by parsing builtin functions as tokens rather than
   `@` as a separate token. This is how stage2 does it.
 * Remove some debugging infrastructure. These will need to be redone,
   if at all, as the code migrates to match stage2.
   - remove the ast_render code.
   - remove the IR debugging stuff
   - remove teh token printing code
2021-05-28 12:58:40 -07:00
Josh Wolfe
8b9434871e Avoid concept of a "Unicode character" in documentation and error messages (#8059) 2021-02-24 08:26:13 -05:00
g-w1
939bd52c8a remove '||=' from stage1
It seems depreciated.
2020-12-26 02:39:34 +02:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Travis
3c7a49c494 add missing case for TokenizeStateSawDotStar at eof 2020-10-29 12:03:45 -05:00
Travis
069aee1495 don't allow a token starting with an asterisk directly following .* 2020-10-29 12:03:45 -05:00
Tadeo Kondrak
069fbb3c01 Add opaque type syntax 2020-10-06 22:08:24 -06:00
Andrew Kelley
750b00c642 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 00:27:48 -07:00
Andrew Kelley
528832bd3a rename src-self-hosted/ to src/ 2020-09-21 18:38:55 -07:00