473,326 Members | 2,732 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,326 software developers and data experts.

JavaScript Complier

Hi there,

Does anyone know if you can download a free javascript complier from
the net. I need to check my code for a project.

Thanks Shannon.

Nov 23 '05 #1
8 7062
JavaScript is generally interpreted language, but you may use Rhino
http://www.mozilla.org/rhino/jsc.html (you must know how to invoke java
programs and how to pass a path to Rhino .jar).
It 'compiles' JavaScript files to Java classes which can be run and
therefor tested.

Nov 23 '05 #2
> Does anyone know if you can download a free javascript complier from
the net. I need to check my code for a project.


Do you need a compiler or a code checker? If the latter, try
http://www.JSLint.com
Nov 23 '05 #3
Luke Matuszewski wrote:
JavaScript is generally interpreted language, [...]


It is not, otherwise it would be too slow for the Web. It is compiled (in
browsers: JIT-compiled) and the resulting byte-code is interpreted by a
Virtual Machine.

SpiderMonkey, Gecko's JavaScript engine written in C (the JavaScript
Reference implementation), compiles (no need for quote characters)
JavaScript source code to JavaScript byte-code to be interpreted by
a JSVM.

<http://developer.mozilla.org/en/docs/SpiderMonkey>

Rhino, written in Java, among other features, can compile JavaScript
source code to both JavaScript byte-code to be interpreted by a JSVM
and Java byte-code to be interpreted by a JVM.

<http://www.mozilla.org/rhino/>
PointedEars
Nov 23 '05 #4

Thomas 'PointedEars' Lahn napisal(a):
Luke Matuszewski wrote:
JavaScript is generally interpreted language, [...]
It is not, otherwise it would be too slow for the Web. It is compiled (in
browsers: JIT-compiled)


You are saying that JavaScript is not interpreted language and then you
states that:
resulting byte-code is interpreted by aVirtual Machine.


In all ECMAScript specs there is NO SUGGESTION on how JavaScript
programs are executed (not a word about Garbage Collector and
JavaScript Virtual Machine). The implementation decides what format and
how it will be executed later.
I mentioned also '''''generally'''' because there is no restriction it
would not be interpreted.
Implementation may decide to produce .exe (PE format file) or .bin (ELF
format file) as a result of compilation, or bytecode to be run on
implementation dependen JSVM (because in specs there is not a word
about format of bytecode, JIT or Hot Swap techniques and other things
like garbage collector algorithms used) but generally there is no need
to. Another case is Java Virtual Machine, which is described in Sun
Specs with Byte Code format - because Java Byte Code is required to run
on platform which has Java Runtime Envirnoment.

As a case of SpiderMonkey - there is no JSVM there - it is embedded
using shared library (or if needed statically linked in C code).

[http://developer.mozilla.org/en/docs...der%27s_Guide]
<quote>
The engine handles memory allocation for the JS data types and objects
needed to execute scripts, and it cleans up -- garbage collects -- the
data types and objects in memory that it no longer needs.
How Do You Use the Engine?
Generally, you build the JS engine as a shared resource. For example,
the engine is a DLL on Windows and Windows NT, and a shared library on
Unix. Then you link your application to it, and embed JS engine
application programming interface (API) calls in your application.
</quote>

As a result personally i think that Rhino is far more easier to use at
hoc than SpiderMonkey (Rhino only requires the Java Runtime Envirnoment
and nothing else).

BR.
Luke.

Nov 23 '05 #5
Douglas Crockford wrote:
Do you need a compiler or a code checker? If the latter,
try http://www.JSLint.com

I've tried to use it with IE, Opera and Mozilla, but the
"jslint" button doesn't do anything. Am I missing something?
JS works in all 3 browsers, my code esecutes as expected.
This is the code I cut and pasted in your page:
http://tinyurl.com/db8v6

Thanks! .:|:.
Nov 23 '05 #6
..:|:. wrote:
I've tried to use it with IE, Opera and Mozilla
Sorry, it's Firefox, not Mozilla.

some more data. When I click "jslint"...

....Opera says:
JSLint, The JavaScript Verifier
http://www.crockford.com/jslint/index.html
Event thread: click
Error:
name: ReferenceError
message: Statement on line 24: Reference to undefined variable: ‘output’
Backtrace:
Line 24 of inline#1 script in http://www.crockford.com/jslint/index.html
document.getElementById(‘output’).innerHTML = r;
Line 1 of script
go();
selectinput();
return false;
At unknown location
[statement source code not available]
....Firefox says
Error: illegal character
Source File: http://www.crockford.com/jslint/index.html
Line: 82, Column: 28
Source Code:
document.getElementById(‘output’).innerHTML = r;

Hope this helps, tanks, .:|:.
Nov 23 '05 #7
Luke Matuszewski wrote:
Thomas 'PointedEars' Lahn napisal(a):
Luke Matuszewski wrote:
> JavaScript is generally interpreted language, [...] It is not, otherwise it would be too slow for the Web. It is compiled
(in browsers: JIT-compiled)


You are saying that JavaScript is not interpreted language and then you
states that:


It is not only and not first an interpreted language.
resulting byte-code is interpreted by aVirtual Machine.


In all ECMAScript specs there is NO SUGGESTION on how JavaScript
programs are executed [...]


Of course not, we are talking about JavaScript, not ECMAScript or one
of its other implementations.
As a case of SpiderMonkey - there is no JSVM there - it is embedded
using shared library (or if needed statically linked in C code).


I wonder if the VM could be implemented through that C code. And
I know about JavaScript programs in byte-code used by at least SSJS.
PointedEars
Nov 23 '05 #8
shannon wrote:
Hi there,

Does anyone know if you can download a free javascript complier from
the net. I need to check my code for a project.

Thanks Shannon.


Is a compiler what you're really looking for? If you're just checking
your code, from what others have already said, JSLint may be what
you're looking for.

http://www.jslint.com

I did come across something more advanced however, and it seems to do a
pretty decent job of catching errors. It's called JS Sorcerer, but it
may do things too advanced for you to understand at this point of time.
If you still want to give it a try, they have an online demo. They
also appear to have an actual compiler if that's what you really
wanted.

http://www.dhitechnologies.com/produ.../testdrive.php

Nov 23 '05 #9

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

Similar topics

0
by: Francisco J. Reyes | last post by:
I get an Internal complier error when compiling C# windows project that uses a custom Class add as reference to the project. The problem appears to be related to the ENUM type used in the class...
3
by: Ygn | last post by:
#include <stdio.h> #include <winsock2.h> #include <windows.h> #include <process.h> #include <string.h> #include <winbase.h> #include <sys/socket.h> I would like to do compiling this header....
5
by: Seven Kast USA | last post by:
Hi pelase explain me complier design of c and i need a small example complier design all phases in c programming . by KAST
2
by: qbin_wang | last post by:
Hi: now i want to download a free c complier which can be used in windows system.and i see many posts in the comp.lang.c,but i don't find the answer.who can tell me the true and correct website...
2
by: Ali Alsaffar | last post by:
Hi there, - I updated my windows XP professional with all critical updates available at windowsupdate.com - I updated Microsoft .NET Framework 1.1.4322 from thier also - I installed Visual Basic...
11
by: jryden | last post by:
I wrote the following code into a console program in Visual C++6. If you build a release build and select custom optimizations and select 'general optimizations' as the only optimization then you...
1
by: tccode97 | last post by:
Hi, I need an urgent help. I am developing a socket application in VC++ that uses asynchronous connnection. After doing search on google, I found the following link ...
11
by: neha | last post by:
Hi My question is : Would the expression *p++=c be disallowed by the complier. The answer given in the book is: No.Because here even though the vlue of p is acced twice it is used to modify...
11
by: =?iso-8859-1?q?Martin_M=FCcke?= | last post by:
Hi, I am looking for a good javascript obfuscator - I found several on the web, but I am looking for one that can also handle javascript in jsp, html and java files - so I need a javascript...
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.