Skip to content

Commit

Permalink
Add contref, nullcontref, etc to the wat/wast formats
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil committed Oct 20, 2023
1 parent 4eb38ce commit 92c223d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions interpreter/text/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ rule token = parse
| "noextern" -> NOEXTERN
| "externref" -> EXTERNREF
| "nullexternref" -> NULLEXTERNREF
| "nocont" -> NOCONT
| "contref" -> CONTREF
| "nullcontref" -> NULLCONTREF
| "ref" -> REF
| "null" -> NULL

Expand Down
5 changes: 5 additions & 0 deletions interpreter/text/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ let inline_tag_type (c : context) (TagT ht) at =
%token<V128.shape> VEC_SHAPE
%token ANYREF NULLREF EQREF I31REF STRUCTREF ARRAYREF
%token FUNCREF NULLFUNCREF EXTERNREF NULLEXTERNREF
%token NOCONT CONTREF NULLCONTREF
%token ANY NONE EQ I31 REF NOFUNC EXTERN NOEXTERN NULL
%token MUT FIELD STRUCT ARRAY SUB FINAL REC
%token UNREACHABLE NOP DROP SELECT
Expand Down Expand Up @@ -354,6 +355,8 @@ heap_type :
| NOFUNC { fun c -> NoFuncHT }
| EXTERN { fun c -> ExternHT }
| NOEXTERN { fun c -> NoExternHT }
| CONT { fun c -> ContHT }
| NOCONT { fun c -> NoContHT }
| var { fun c -> VarHT (StatX ($1 c type_).it) }

ref_type :
Expand All @@ -368,6 +371,8 @@ ref_type :
| NULLFUNCREF { fun c -> (Null, NoFuncHT) } /* Sugar */
| EXTERNREF { fun c -> (Null, ExternHT) } /* Sugar */
| NULLEXTERNREF { fun c -> (Null, NoExternHT) } /* Sugar */
| CONTREF { fun c -> (Null, ContHT) } /* Sugar */
| NULLCONTREF { fun c -> (Null, NoContHT) } /* Sugar */

val_type :
| NUM_TYPE { fun c -> NumT $1 }
Expand Down

0 comments on commit 92c223d

Please sign in to comment.