Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ project/.bloop/bloop.settings.json
conc_gen/*
ccbse_gen/*
headers/gensym/external.hpp
grammar/.antlr/
24 changes: 24 additions & 0 deletions benchmarks/wasm/sum.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(module
(type (;0;) (func (param i32)))
(import "console" "log" (func (type 0)))
(func (param i32 i32) (result i32)
local.get 0
i32.eqz
if (result i32)
local.get 1
else
local.get 0
i32.const 1
i32.sub
local.get 1
local.get 0
i32.add
(return_call 1)
end
)
(func (result i32)
i32.const 10
i32.const 0
(return_call 1))
(export "sum10" (func 2))
)
2 changes: 2 additions & 0 deletions grammar/WatLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ ELSE: 'else' ;
SELECT: '.select' ;
CALL: 'call' ;
CALL_INDIRECT: 'call_indirect' ;
RETURN_CALL: 'return_call' ;
RETURN_CALL_INDIRECT: 'return_call_indirect' ;

LOCAL_GET: 'local.get' ;
LOCAL_SET: 'local.set' ;
Expand Down
3 changes: 3 additions & 0 deletions grammar/WatParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ plainInstr
| BR_TABLE idx+
| RETURN
| CALL idx
| RETURN_CALL idx
| LOCAL_GET idx
| LOCAL_SET idx
| LOCAL_TEE idx
Expand Down Expand Up @@ -177,6 +178,7 @@ selectInstr
callIndirectInstr
/* : CALL_INDIRECT typeUse? callInstrParams */
: CALL_INDIRECT idx? typeUse
| RETURN_CALL_INDIRECT idx? typeUse
;

callInstrParams
Expand Down Expand Up @@ -220,6 +222,7 @@ foldedInstr
expr
: plainInstr expr*
| CALL_INDIRECT callExprType
| RETURN_CALL_INDIRECT callExprType
| BLOCK bindVar? block
| LOOP bindVar? block
// | IF bindVar? ifBlock
Expand Down
2,565 changes: 1,294 additions & 1,271 deletions src/main/java/wasm/WatLexer.java

Large diffs are not rendered by default.

Loading
Loading