Skip to content
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

Merged
merged 10 commits into from
Mar 3, 2018
Merged

Conversation

ballercat
Copy link
Owner

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.

@coveralls
Copy link

coveralls commented Mar 2, 2018

Coverage Status

Coverage decreased (-0.3%) to 96.733% when pulling 3169403 on better-developer-tools into 10dcfbb on beta.

(i32.const 2) ;␊
) ;␊
(return ;␊
(??.add ;␊
Copy link

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?

Copy link
Owner Author

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.

@xtuc
Copy link

xtuc commented Mar 2, 2018

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?

@@ -64,7 +72,8 @@ class Explorer extends React.Component {
requestAnimationFrame(() => {
try {
this.intermediateRepresentation = getWaltIR(this.state.code);
const wasm = debugWalt(this.intermediateRepresentation);
// double parse :(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for each frame?

Copy link
Owner Author

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.

@ballercat ballercat changed the base branch from master to beta March 3, 2018 22:09
@ballercat ballercat closed this Mar 3, 2018
@ballercat ballercat changed the base branch from beta to development March 3, 2018 22:42
@ballercat ballercat reopened this Mar 3, 2018
@ballercat ballercat merged commit e2c5217 into development Mar 3, 2018
@ballercat ballercat deleted the better-developer-tools branch March 3, 2018 23:02
ballercat added a commit that referenced this pull request Mar 11, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants