Not sure where a good place to start is. They're no different than ASTs for
any other language. uglify-js dumps out a big nested array which is a
pretty good start if you want to see about what is going on.
I got started in meta-programming with Bison which is a C parser and Flex
which is a C
If you are curious about uglify's parse trees, I've got a wrapper around uglify
that spits out the tree for any given JavaScript in the loop project
(https://github.com/smtlaissezfaire/loop/blob/master/script/uglify-syntax-tree-json)
Best
Scott
On Aug 30, 2012, at 12:23 PM, Dan Milon
Yeah I understand the purpose of maintaining comments; I've actually
written a lot of source-to-source transformations myself. The reason I ask
is that I always found it cumbersome to stick non-AST information on the
AST itself. For instance, for /* this is my loop */ (/* this is my
initializer */
Well, the good news is that I'm maintaining both start/end tokens in
all AST nodes, and inside tokens I maintain line/col/pos/endpos too.
And on top of this, there's a comments_before array in all tokens
which tell what comments were found before that token (though that's
not so useful for perfect
Out of topic, but you gave me the clues.
Do you know where i can read up about AST trees for javascript?
Thanks a ton,
danmilon.
On 08/30/2012 12:27 AM, Marcel Laverdet wrote:
Just curious why you need the comments in the AST at all? If you've
got the start position length of every token in
Wonderful! I've been working on a project that is sort of like parenscript -
but much more of a straight javascript in lisp/scheme clothes with a
define-syntax macro system.
https://github.com/smtlaissezfaire/loop
I've been hacking on the 1x source of uglify to translate javascript into a
Well, the code generator doesn't yet have an option to keep comments,
but I can add it easily; the harder part was having them in the AST,
and that's done.
What exactly are you trying to achieve? My understanding is that you
compile Lisp to JS (cool!), do you want to be able to do the reverse
I personally would love to use the new UglifyJS as a code *beautifier*,
which becomes feasible now if it’s able to keep comments intact.
-FG
On 8/29/12 8:37 AM, Mihai Călin Bazon wrote:
Well, the code generator doesn't yet have an option to keep comments,
but I can add it easily; the harder
Just curious why you need the comments in the AST at all? If you've got the
start position length of every token in the AST (much easier to do) you
implicitly have the comments as well. The fiber engine in Streamline (
https://github.com/Sage/streamlinejs/blob/master/lib/fibers/transform.js)
does
Obviously it depends what you are trying to do. Usually compiled programming
languages strip them out in the tokenizer; for source to source translations
sometimes you want to keep them in (for instance a header with copyright notice
when compressing or *all* of them in a case like mine)
Best
On Tue, Aug 28, 2012 at 5:33 AM, Scott Taylor sc...@railsnewbie.com wrote:
Very cool. What comments in the AST are you going to preserve?
The new AST is able to store all comments, and the compressor and code
generator will be able to keep most of them. However, I suspect that
in general
Hi all,
I thought I'd drop this here for anyone using UglifyJS that's not
reachable through other channels: I started work on version 2 and it's
already usable, although not yet as good as v1 in terms of
compression. The goals of the rewrite are to have cleaner and more
maintainable code, a
Very cool. What comments in the AST are you going to preserve?
Best
Scott
On Aug 27, 2012, at 3:09 AM, Mihai Călin Bazon mihai.ba...@gmail.com wrote:
Hi all,
I thought I'd drop this here for anyone using UglifyJS that's not
reachable through other channels: I started work on version 2
13 matches
Mail list logo