diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-12-16 00:49:59 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-12-16 17:02:35 +0000 |
| commit | c7485d73ac3e6dd105c6ee8fcf774493cc9eb31e (patch) | |
| tree | 0312df770a62af9cc5bf2f36d865df189ff21a2f /src/InternPool.zig | |
| parent | d12c0bf90911339c8db0741b257eac251b827b2c (diff) | |
| download | zig-c7485d73ac3e6dd105c6ee8fcf774493cc9eb31e.tar.gz zig-c7485d73ac3e6dd105c6ee8fcf774493cc9eb31e.zip | |
compiler: introduce ZonGen and make `ast-check` run it for ZON inputs
Currently, `zig ast-check` fails on ZON files, because it tries to
interpret the file as Zig source code. This commit introduces a new
verification pass, `std.zig.ZonGen`, which applies to an AST in ZON
mode.
Like `AstGen`, this pass also converts the AST into a more helpful
format. Rather than a sequence of instructions like `Zir`, the output
format of `ZonGen` is a new datastructure called `Zoir`. This type is
essentially a simpler form of AST, containing only the information
required for consumers of ZON. It is also far more compact than
`std.zig.Ast`, with the size generally being comparable to the size of
the well-formatted source file.
The emitted `Zoir` is currently not used aside from the `-t` option to
`ast-check` which causes it to be dumped to stdout. However, in future,
it can be used for comptime `@import` of ZON files, as well as for
simpler handling of files like `build.zig.zon`, and even by other parts
of the Zig Standard Library.
Resolves: #22078
Diffstat (limited to 'src/InternPool.zig')
0 files changed, 0 insertions, 0 deletions
