Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xsmith
WebAssembly Sandbox
Commits
634b779a
Commit
634b779a
authored
Dec 06, 2019
by
Guy Watson
Browse files
Add conditional branches
parent
088decd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
wasmlike/wasmlike.rkt
View file @
634b779a
...
...
@@ -36,6 +36,11 @@
[
targetindex
])
;; a number depth
;; todo: the type of val should be unified with the target node
#:prop
choice-weight
50
]
[
BranchIf
Expr
([
cond
:
Expr
]
[
val
:
Expr
]
[
targetnode
]
[
targetindex
])
#:prop
choice-weight
50
]
)
;; Define structured control instruction property
...
...
@@ -125,7 +130,9 @@
wasm-like
fresh
[
Branch
(
match-let
([(
cons
index
node
)
(
choose-br-target
(
current-hole
))])
(
hash
'targetindex
index
'targetnode
node
))])
(
hash
'targetindex
index
'targetnode
node
))]
[
BranchIf
(
match-let
([(
cons
index
node
)
(
choose-br-target
(
current-hole
))])
(
hash
'targetindex
index
'targetnode
node
))])
(
add-att-rule
wasm-like
...
...
@@ -164,6 +171,8 @@
'then
int
'else
int
))]]
[
Branch
[
int
(
λ
(
n
t
)
(
hash
'val
int
))]]
[
BranchIf
[
int
(
λ
(
n
t
)
(
hash
'cond
int
'val
int
))]]
)
(
add-prop
...
...
@@ -200,6 +209,12 @@
(
append
(
render-node
(
ast-child
'val
n
))
`
(
br
,
(
ast-child
'targetindex
n
))))]
[
BranchIf
(
λ
(
n
)
(
append
(
render-node
(
ast-child
'val
n
))
(
render-node
(
ast-child
'cond
n
))
`
(
br_if
,
(
ast-child
'targetindex
n
))))]
)
(
add-prop
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment