473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

JavaScript parser in lex+yacc or jflex+byacc/j

does anyone know of a "reasonably practical" yacc-type parser for
JavaScript?

in the absence of one, i will endevour to write my own starting from
the BNF specification:

http://www.ecma-international.org/pu...T/Ecma-262.pdf

any help/pointers gratefully received...

May 23 '06 #1
7 12015
VK

macabstract wrote:
does anyone know of a "reasonably practical" yacc-type parser for
JavaScript?


http://www.jslint.com

.... unless what does "reasonably practical" mean to you?

May 23 '06 #2
i need a lexer/parser in a high-level parsing language such as lex/yacc
rather than a coded-from-scratch one in C/Java/JS (as is the case with
jslint).

my motivation is to write a JavaScript/AJAX obfuscation utility to
mangle variable names between JavaScript and the server-side language
(typically Java/C#).

by "reasonably practical" (apologies for my vagueness), i meant that
the grammar used should be consistent with JavaScript used in popular
browsers such as Mozilla and IE.

May 24 '06 #3
macabstract wrote:
my motivation is to write a JavaScript/AJAX obfuscation utility to
mangle variable names between JavaScript and the server-side language
(typically Java/C#).
What should this be good for?
by "reasonably practical" (apologies for my vagueness), i meant that
the grammar used should be consistent with JavaScript used in popular
browsers such as Mozilla and IE.


Unlike Mozilla and other Gecko-based UAs, IE supports JScript, not
JavaScript. Furthermore, JavaScript and JScript are ECMAScript
implementations that extend the specified language; probably you
will have to take several peculiarities of those languages into
account.
PointedEars
--
#define QUESTION ((bb) || !(bb))
// William Shakespeare (if he would have been a hacker ;-))
May 25 '06 #4
Thomas 'PointedEars' Lahn wrote:
Unlike Mozilla and other Gecko-based UAs, IE supports JScript, not
JavaScript. Furthermore, JavaScript and JScript are ECMAScript
implementations that extend the specified language;


When the implementations were created before the standard existed, is it
really accurate to say they are implementations of the standard? That's
putting the cart before the horse.

Shouldn't you say that ECMAScript is a proposed standard which attempts to
unify, extend, and standardize Javascript and JScript into a language
definition that encapsulates most of the functionality of each and provides
a starting point for future new implementations and changes to Javascript
and JScript?

Repeatedly parroting that "Javascript and JScript are ECMAScript
implementations" is a bit misleading, IMO.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
May 25 '06 #5
"macabstract" <ma*********@yahoo.co.uk> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
does anyone know of a "reasonably practical" yacc-type parser for
JavaScript?

in the absence of one, i will endevour to write my own starting from
the BNF specification:

http://www.ecma-international.org/pu...T/Ecma-262.pdf

any help/pointers gratefully received...


The DMS Software Reengineering Toolkit has excellent parsers for
Javascript. It is frankly a lot of work to get the details for the
various
Javascript dialects right. DMS also provides considerable
support for custom analysis or transformation on the parsed
code.

We use DMS + these grammars to provide JavaScript source formatting tools,
obfuscation tools (which some folks in this group just can't
get over) and other tools that require deep, detailed access to the
JavaScript
(and/or the HTML page in which it is often embedded),
such as clone detection. An example next tool on which we are
working would be test coverage for JavaScript;
we've already delivered test coverage tools for half a dozen
other languages using DMS.

See http://www.semanticdesigns.com/Produ...MSToolkit.html
--
Ira Baxter, CTO
www.semanticdesigns.com
May 25 '06 #6
Matt Kruse said the following on 5/25/2006 3:50 PM:
Thomas 'PointedEars' Lahn wrote:
Unlike Mozilla and other Gecko-based UAs, IE supports JScript, not
JavaScript. Furthermore, JavaScript and JScript are ECMAScript
implementations that extend the specified language;
When the implementations were created before the standard existed, is it
really accurate to say they are implementations of the standard? That's
putting the cart before the horse.


Thats putting the cart before the wheel before the horse.
Shouldn't you say that ECMAScript is a proposed standard which attempts to
unify, extend, and standardize Javascript and JScript into a language
definition that encapsulates most of the functionality of each and provides
a starting point for future new implementations and changes to Javascript
and JScript?
But then they all repeat the "But the website says it is an ECMAScript
implementation".
Repeatedly parroting that "Javascript and JScript are ECMAScript
implementations" is a bit misleading, IMO.


It is very misleading.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 25 '06 #7
Matt Kruse wrote:
<snip>
When the implementations were created before the
standard existed, is it really accurate to say they
are implementations of the standard? That's putting
the cart before the horse.

<snip>

When pre-existing JavaScript(tm) and JScript implementations have
changed in a way that brings them into line with ECMA 262 editions, and
then been claimed by their authors to be ECMAScript implementations,
shoudn't we accept that that is what they are.

The significant differences between JavaScript(tm) 1.2 and 1.3, where
the latter brought JavaScript(tm) into line with ECMA 262, 2nd Ed. being
an obvious example. The introduction of previously absent
properties/methods into JScript 5.6 to bring it into line with ECMA 262,
3rd Ed. being another.

Richard.
May 25 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Moonlit | last post by:
Hi, I am searching for the best lex and yacc combination (or something similar) that can be used in combination with C++ and that can contain C++ code. I have the regular flex/bison port working...
28
by: Yuri CHUANG | last post by:
"No newline at the end of your output" is really a problem? I've never learned that before. So I desire to know some tips about writting a program perfectly.Can anyone give me some tips which are...
5
by: alebcn75 | last post by:
Hello, I'm trying to solve the following issue which is puzzling me. I have a concrete class, say Parser, which provides some basic parsing functionality (such as reading word by word, line by...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.