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

It would be great if the AST format would follow the de facto JS standard #2

Open
cos opened this issue May 20, 2015 · 4 comments
Open

Comments

@cos
Copy link
Member

cos commented May 20, 2015

The standard is informally maintained here:
https://github.com/estree/estree

@daejunpark
Copy link
Contributor

Could you please explain any use case in mind?

@cos
Copy link
Member Author

cos commented May 20, 2015

entree (i.e., Mozilla Parser API) is the de facto standard for JavaScript parsers. There are several high-performance, widely-used parsers implementing the API: esprima, espree, acorn, etc.

Following the same format would, on the one hand, allow the K parser to be used as a parser for various JS tools, and, on the other hand, it would allow us to use any of those parsers for parsing JS programs almost without compatibility issues.

Why would you care about the latter? You could, for example, compile the KJS to a K JS rewriter and then deploy the compiled rewriter to a web site. You wouldn't need the entire K infrastructure as the rules are already in AST format, and any program inputs would be parsed using one of the fast pure JS parsers.

@cos
Copy link
Member Author

cos commented May 20, 2015

Bottom line, if we want to have any chance of adoption of K in the JS world, we would need to follow their standards, and be able to run in a pure JS mode.

@daejunpark
Copy link
Contributor

Indeed, I was thinking of using Shift parser:
https://github.com/shapesecurity/shift-parser-js
To my knowledge, it is the most complete parser for ES6:
https://esdiscuss.org/topic/parser-for-es6
Its AST is similar with the one you mentioned, and they have a bidirectional converter as well.

BTW, what do you mean by compiling to K JS rewriter? Do you mean using the term rewriting engine written in JS that you mentioned before? Could you elaborate it more?

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

No branches or pull requests

2 participants