-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing duplicate prose #69
Conversation
Instr_ok/reinterpret | ||
Instr_ok/convert-* | ||
} | ||
$${rule+: Instr_ok/cvtop-*} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was supposed to test splices with multiple rule patterns listed, so preferably change it to
$${rule+: Instr_ok/cvtop-*} | |
$${rule+: | |
Instr_ok/cvtop-reinterpret | |
Instr_ok/cvtop-convert-* | |
} |
let get_name = function | ||
| Al.Ast.RuleA ((id, _), _, _) -> id | ||
| Al.Ast.FuncA (id, _, _) -> id | ||
in | ||
let al_manual = Backend_interpreter.Manual.manual_algos in | ||
let names_manual = List.map get_name al_manual in | ||
let al_translated = | ||
List.filter | ||
(fun algo -> | ||
let name_translated = get_name algo in | ||
not (List.mem name_translated names_manual)) | ||
(Il2al.Translate.translate il) | ||
in | ||
al_translated @ al_manual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workaround shouldn't be in main. Can you move it to the backend somehow? Also, add a comment explaining why this is needed, and that (supposedly?) it's a TODO to get rid of the workaround eventually.
This PR went stale, but will soon revisit on this issue :) |
When looking up a type on the context, expand it (using `~~`) into the expected composite type instead of using equality (`=`). Also fix some places where equality should have been used when looking up tags. Add `func` to expanded function types.
As mentioned in #63, there were duplicate prose for:
There were two reasons:
(1) Manually-written algorithms
Execution algorithms for
exec/array.new_data
andexec/call_ref
are written manually inbackend-interpreter/manual.ml
, for translating them to AL were quite tricky. The problem was that the failed translation (indicated byYetI
) fromil2al/translate.ml
and the manual algorithms were counted twice. Thus, I've modifiedexe-watsup/main.ml
to nullify the failed translations for manual algorithms.This resolves the upper-two warnings.
(2) Prefix validation rule names
When translating formal rules to prose, we first group validation rules by their name's prefix. For example,
Instr_ok/select-expl
andInstr_ok/select-impl
are grouped by their prefixselect-
. The rule names for the validation ofcvtop
were not properly named with the same prefix, so I re-named them to:cvtop-reinterpret
,cvtop-convert-i
, andcvtop-convert-f
.This handles the last warning, so all warnings are now gone. Yet, the current validation prose generator cannot handle multiple validation rules per Wasm instruction.
select
andcvtop
are such cases, where the generator only takes the first rule and translates it, ignoring the rest.spectec/spectec/src/backend-prose/gen.ml
Line 83 in 9a1f564
This should be addressed, but will take some time since this requires some discussion with @f52985.