summaryrefslogtreecommitdiff
path: root/src/parser/contexts.h
Commit message (Collapse)AuthorAgeFilesLines
...
* [Parser] Parse tables and element segments (#6147)Thomas Lively2023-12-061-13/+150
| | | | | | | These module fields are especially complex to parse because they contain both nontrivial types and instructions, so their parsing logic needs to be spread out across the ParseDecls, ParseModuleTypes, and ParseDefs phases of parsing. This applies to in-line elements in table definitions as well, which means we need to be able to match a table to its in-line element segment across multiple phases.
* [Parser] Parse try/catch/catch_all/delegate (#6128)Thomas Lively2023-11-291-5/+32
| | | | | | | | | | | | | | Parse the legacy v3 syntax for try/catch/catch_all/delegate in both its folded and unfolded forms. The first sources of significant complexity is the optional IDs after `catch` and `catch_all` in the unfolded form, which can be confused for tag indices and require backtracking to parse correctly. The second source of complexity is the handling of delegate labels, which are relative to the try's parent scope despite being parsed after the try's scope has already started. Handling this correctly requires punching a whole big enough to drive a truck through through both the parser and IRBuilder abstractions.
* [Parser] Parse tags and throw (#6126)Thomas Lively2023-11-201-0/+55
| | | | Also fix the parser to correctly error if an imported item appears after a non-imported item and make the corresponding fix to the test.
* [Parser] Parse call_ref (#6103)Thomas Lively2023-11-151-0/+7
| | | | Also mark array.new_elem as unimplemented as a drive-by; it previously had an incorrect implementation.
* [Parser] Parse array.new_fixed (#6102)Thomas Lively2023-11-151-0/+8
|
* [Parser] Parse RefAs expressions (#6101)Thomas Lively2023-11-151-0/+5
|
* [Parser] Parse BrOn expressions (#6100)Thomas Lively2023-11-151-0/+11
|
* [Parser] Parse ref.test and ref.cast (#6099)Thomas Lively2023-11-151-0/+10
|
* [Parser] Parse br_table (#6098)Thomas Lively2023-11-151-0/+8
|
* [Parser] Parse ref.func (#6097)Thomas Lively2023-11-151-2/+5
|
* [Parser] Parse `call` and `return_call` (#6086)Thomas Lively2023-11-071-0/+23
| | | | To support parsing calls, add support for parsing function indices and building calls with IRBuilder.
* Typed Continuations: Add cont type (#5998)Frank Emrich2023-10-241-0/+7
| | | | | | | | | This PR is part of a series that adds basic support for the [typed continuations proposal](https://github.com/wasmfx/specfx). This PR adds continuation types, of the form `(cont $foo)` for some function type `$foo`. The only notable changes affecting existing code are the following: - This is the first `HeapType` which has another `HeapType` (rather than, say, a `Type`) as its immediate child. This required fixes to certain traversals that have a flag for being at the toplevel of a type. - Some shared logic for parsing `HeapType`s has been factored out.
* [Parser] Parse labels and br (#5970)Thomas Lively2023-10-021-1/+15
| | | | | | The parser previously parsed labels and could attach them to control flow structures, but did not maintain the context necessary to correctly parse branches. Support parsing labels as both names and indices in IRBuilder, handling shadowing correctly, and use that support to implement parsing of br.
* Support function contexts in IRBuilder (#5967)Thomas Lively2023-09-221-2/+3
| | | | | | Add a `visitFunctionStart` function to IRBuilder and make it responsible for setting the function's body when the context is closed. This will simplify outlining, will be necessary to support branches to function scope properly, and removes an extra block around function bodies in the new wat parser.
* [Parser] Support loops (#5966)Thomas Lively2023-09-211-4/+16
| | | Parse loops in the new wat parser and add support for them to the IRBuilder.
* [NFC][Parser] Simplify instruction handling (#5964)Thomas Lively2023-09-211-86/+66
| | | | | | | | | | | The new wat parser previously returned InstrT types when parsing individual instructions and collected InstrsT types when parsing sequences of instructions. However, instructions were always actually tracked in the internal state of the parsing context, so these types never held any interesting or necessary data. Simplify the parser by removing these types and leaning into the pattern that the parser context will keep track of parsed instructions. This allows for a much cleaner separation between the `instrs` and `foldedinstrs` parser functions.
* [Parser] Parse if-else in the new wat parser and IRBuilder (#5963)Thomas Lively2023-09-211-2/+17
| | | | | | Parse both the straight-line and folded versions of if, including the abbreviations that allow omitting the else clause. In the IRBuilder, generalize the scope stack to be able to track scopes other than blocks and add methods for visiting the beginnings of ifs and elses.
* [NFC] Split the new wat parser into multiple files (#5960)Thomas Lively2023-09-191-0/+1275
And put the new files in a new source directory, "parser". This is a rough split and is not yet expected to dramatically improve compile times. The exact organization of the new files is subject to change, but this splitting should be enough to make further parser development more pleasant.