anko / eslisp

un-opinionated S-expression syntax and macro system for JavaScript
ISC License
528 stars 31 forks source link

How to convert JS into eslisp syntax? #26

Closed reverofevil closed 8 years ago

reverofevil commented 8 years ago

I would like to reimplement some infrastructure like browserify over eslisp syntax, because it's common for such utilities to have imperative API that is very hard to extend, and I don't trust their conversion methods. But this would require not only JS pretty printer, but a JS parser too.

Is there already such an utility?

anko commented 8 years ago

There's no JS → eslisp decompiler, if that's what you mean.

It might be possible to write a decompiler, using esprima to parse JavaScript into an estree object and writing logic that does the inverse of the built-in macros, and producing eslisp code. However, it could only easily produce "core" eslisp code that uses the built-in macros (which match 1-to-1 with JavaScript). Anything else would take fairly substantial work on pattern matching.

I'm unsure what you mean by the browserify comparison. Could you elaborate?

anko commented 8 years ago

Closing this for now, because I'm unclear on what you meant.

This sounded interesting though—if you could clarify, I'll reopen.