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 <[email protected]> wrote:

> 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 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 this with really good results.
>> 
>> On Wed, Aug 29, 2012 at 8:37 AM, Mihai Călin Bazon <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>>    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
>>    transform?  If so, perhaps a better idea is to generate a source map.
>>    (not sure what you need to do though, just guessing)
>> 
>>    Cheers,
>>    -Mihai
>> 
>>    On Wed, Aug 29, 2012 at 1:52 PM, Scott Taylor
>>    <[email protected] <mailto:[email protected]>> wrote:
>>    > 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
>>    > lispy type system (and back) - but inline comments have been a
>>    cause of
>>    > concern.  Where is the 2.x source at this point?
>>    >
>>    > Cheers,
>>    >
>>    > Scott
>>    >
>>    > On Aug 28, 2012, at 12:56 PM, Mihai Călin Bazon wrote:
>>    >
>>    > On Tue, Aug 28, 2012 at 5:33 AM, Scott Taylor
>>    <[email protected] <mailto:[email protected]>> 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 people will only need to store copyright notices, and
>>    those
>>    > usually start with some special marker like "/*!".  It'll be easy to
>>    > add a configuration option to keep such comments, as long as they're
>>    > not in code that's going to be dropped (for example dead code, like,
>>    > code that follows a return, throw, break or continue statement).
>>    >
>>    > Cheers,
>>    > --
>>    > Mihai Bazon,
>>    > http://mihai.bazon.net/blog
>>    >
>>    > --
>>    > Job Board: http://jobs.nodejs.org/
>>    > Posting guidelines:
>>    > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>    > You received this message because you are subscribed to the Google
>>    > Groups "nodejs" group.
>>    > To post to this group, send email to [email protected]
>>    <mailto:[email protected]>
>>    > To unsubscribe from this group, send email to
>>    > [email protected]
>>    <mailto:nodejs%[email protected]>
>>    > For more options, visit this group at
>>    > http://groups.google.com/group/nodejs?hl=en?hl=en
>>    >
>>    >
>>    > --
>>    > Job Board: http://jobs.nodejs.org/
>>    > Posting guidelines:
>>    > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>    > You received this message because you are subscribed to the Google
>>    > Groups "nodejs" group.
>>    > To post to this group, send email to [email protected]
>>    <mailto:[email protected]>
>>    > To unsubscribe from this group, send email to
>>    > [email protected]
>>    <mailto:nodejs%[email protected]>
>>    > For more options, visit this group at
>>    > http://groups.google.com/group/nodejs?hl=en?hl=en
>> 
>> 
>> 
>>    --
>>    Mihai Bazon,
>>    http://mihai.bazon.net/blog
>> 
>>    --
>>    Job Board: http://jobs.nodejs.org/
>>    Posting guidelines:
>>    https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>    You received this message because you are subscribed to the Google
>>    Groups "nodejs" group.
>>    To post to this group, send email to [email protected]
>>    <mailto:[email protected]>
>>    To unsubscribe from this group, send email to
>>    [email protected]
>>    <mailto:nodejs%[email protected]>
>>    For more options, visit this group at
>>    http://groups.google.com/group/nodejs?hl=en?hl=en
>> 
>> 
>> -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
> 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to