-
Notifications
You must be signed in to change notification settings - Fork 122
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
Print nodes as wast text format #92
Conversation
(i32.const 2) ;␊ | ||
) ;␊ | ||
(return ;␊ | ||
(??.add ;␊ |
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 should be i32.add
, right?
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.
There are two AST phases in the compiler. One of them, the first one, doesn't have type information. This is what we see here.
I want equal debug support for both phases though. The printer will omit the types when they aren't yet set.
Binary expressions are left without types in this phase because walt supports implicit type promotions and eventually type inference. The types of the expression are guaranteed to be balanced. It's trivial to do this with an additional phase which can apply types based on a full AST.
FYI I have this for my AST https://github.com/xtuc/webassemblyjs/tree/master/packages/wast-printer. You can use it for inspiration or we can figure out some AST<>AST transform to use it? |
packages/walt-docs/src/app.js
Outdated
@@ -64,7 +72,8 @@ class Explorer extends React.Component { | |||
requestAnimationFrame(() => { | |||
try { | |||
this.intermediateRepresentation = getWaltIR(this.state.code); | |||
const wasm = debugWalt(this.intermediateRepresentation); | |||
// double parse :( |
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.
And for each frame?
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.
Each frame? Only when the code is compiled. I was a bit lazy here, I need to use the parsed AST as the input for the generator.
* Print nodes as wast text format (#92) * Global arrays (#93) * Join together compiler tests * fix global arrays * fix sniffs * fix i64 global bug (#96) * Better metadata (#97) * make metadata a poj-o * remove getter * coverage * Memory, Table as generics syntax (#98) * generic memory type * delete some old specs * update specs * Support Table<> syntax, update examples + specs * Name section and basic config object (#102) * Implement basic name section * implement full name section * make version configurable * fix flow errors * start tweaking unit test reports * Identify and fix loop bugs * fix imports bugs, more coverage * builds
Some debugging & developing improvements to the
printNode
utility. Instead of printing a custom output for the nodes in a tree output a wast-like(it's not exactly run-able code) format. Also, updated explorer site to print this format instead of raw binary dissasembler.