Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Esmangle: mangling tool for Mozilla Parser AST

Received: by 10.50.173.42 with SMTP id bh10mr1325805igc.1.1346431371757;
        Fri, 31 Aug 2012 09:42:51 -0700 (PDT)
X-BeenThere: esprima@googlegroups.com
Received: by 10.231.51.106 with SMTP id c42ls7476935ibg.3.gmail; Fri, 31 Aug
 2012 09:42:51 -0700 (PDT)
Received: by 10.43.13.137 with SMTP id pm9mr4504952icb.0.1346431371143;
        Fri, 31 Aug 2012 09:42:51 -0700 (PDT)
Received: by 10.43.13.137 with SMTP id pm9mr4504951icb.0.1346431371122;
        Fri, 31 Aug 2012 09:42:51 -0700 (PDT)
Return-Path: <utatane....@gmail.com>
Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178])
        by gmr-mx.google.com with ESMTPS id ba5si379774igb.3.2012.08.31.09.42.51
        (version=TLSv1/SSLv3 cipher=OTHER);
        Fri, 31 Aug 2012 09:42:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of utatane....@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of utatane....@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=utatane....@gmail.com; dkim=pass header...@gmail.com
Received: by mail-ob0-f178.google.com with SMTP id wd20so7126400obb.37
        for <esprima@googlegroups.com>; Fri, 31 Aug 2012 09:42:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:from:date:message-id:subject:to:content-type;
        bh=x75ngNT5q3kzBT1tb/5Gh2qB31lgMekm+O97YSivwes=;
        b=rkhdGEgGy5jdzpJ6b9Yeh65P1yQQOLdI4VVOXQtFdmWWFDvGdrF4kHRoyAjb6QAiCO
         4TdSHnGcN3mywDWeEsX22zn91hs3RL6rZ0soN1DK9NVUtXi6oHUo9p6fC9y1yW2/liKk
         q91Ugf6PGrQiO4Y9R4BdGsoYK4PA8JfiJ3dV/Jr1hcZrXFuoaJc7bpiECt6BfZlif/4F
         ugdUUb7HrpX1ylrQDK2dJ0tXOfa2FBIJoHWWbOin/ailawY9bxSmyBXw0VJMTgeQde4E
         g1Mnqqmq0o9U0DVmaeyHXN/UKkMf7y3mOodrK2T09C++yitXUYNCPaEf6EtRRfG/TmSi
         XEtw==
Received: by 10.182.193.105 with SMTP id hn9mr8499723obc.11.1346431370985;
 Fri, 31 Aug 2012 09:42:50 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.60.67.8 with HTTP; Fri, 31 Aug 2012 09:42:20 -0700 (PDT)
From: Yusuke Suzuki <utatane....@gmail.com>
Date: Sat, 1 Sep 2012 01:42:20 +0900
Message-ID: <CANewFPSyF+aHUn9ki_XzgsmyZbtBOj8gBhvhk1NfQBiJWqg...@mail.gmail.com>
Subject: Esmangle: mangling tool for Mozilla Parser AST
To: esprima@googlegroups.com
Content-Type: multipart/alternative; boundary=f46d0446317895013f04c8927b8f

--f46d0446317895013f04c8927b8f
Content-Type: text/plain; charset=ISO-8859-1

Hello all,

Last night, I decided to implement some AST modifying pass, and created
esmangle : mangling tool for Mozilla Parser AST.
http://constellation.github.com/esmangle/

This is created yesterday and test cases are very few, so it is still
experimental. :)

We can use it like this,

var first = esprima.parse(code);
var tree =esmangle.mangle(first);
var res = escodegen.generate(first, { format: { compact: true, semicolons:
false, renumber: true, hexadecimal: true, escapeless: true } });

You can try this on the demo page.

To get more compression ratio, we should create AST modifying pass like

+ remove wasted block. (`if (cond) { stmt; }` => `if (cond) stmt;)
+ reordering declarations
+ concat multiple var declarations into one

Thanks.

--f46d0446317895013f04c8927b8f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello all,<div><br></div><div>Last night, I decided to implement some AST m=
odifying pass, and created esmangle : mangling tool for Mozilla Parser AST.=
</div><div><a href=3D"http://constellation.github.com/esmangle/">http://con=
stellation.github.com/esmangle/</a></div>


<div><br></div><div>This is created yesterday and test cases are very few, =
so it is still experimental. :)</div><div><br></div><div>We can use it like=
 this,</div><div><br></div><div>var first =3D esprima.parse(code);</div>


<div>var tree =3Desmangle.mangle(first);</div><div>var res =3D escodegen.ge=
nerate(first, { format: { compact: true, semicolons: false, renumber: true,=
 hexadecimal: true, escapeless: true } });</div><div><br></div><div>You can=
 try this on the demo page.</div>

<div><br></div><div>
To get more compression ratio, we should create AST modifying pass like</di=
v><div><br></div><div>+ remove wasted block. (`if (cond) { stmt; }` =3D&gt;=
 `if (cond) stmt;)</div><div>+ reordering declarations</div>
<div>+ concat multiple var declarations into one</div><div><br></div><div>T=
hanks.</div>

--f46d0446317895013f04c8927b8f--