Javascript compiler
The JavaScript
compiler translates JavaScript source into Java class files. The resulting Java
class files can then be loaded and executed at another time, providing a
convenient method for transferring JavaScript, and for avoiding translation
cost.
JavaScript JIT compilers
The first JavaScript
JIT compiler was Mozilla’s TraceMonkey This was a “tracing jit" so-called
because it traces a path through your code looking for commonly executed code
loops.
These “hot loops” are
then compiled into machine code. With this optimisation alone Mozilla were able
to achieve performance gains of 20% to 40% over their previous engine.
Shortly after
TraceMonkey launched Google debuted its Chrome browser along with it’s new V8
JavaScript engine.
V8 had been designed
specifically to execute at speed. A key design decision was to skip bytecode
generation entirely and instead have the translator emit native code.
Parser
The word
"parse" means to analyze an object specifically. It is commonly used
in computer science to refer to reading program code.
Before the engine can
execute the code, it has to feed the source into its parser The purpose of
the parser is to perform the syntactic analysis and to produce an abstract
syntax tree (AST).
PEG.js is a simple
parser generator for JavaScript that produces fast parsers with excellent error
reporting. You can use it to process complex data or computer languages and
build transformers, interpreters, compilers and other tools easily.
Features
- Simple and expressive grammar syntax
- Integrates both lexical and syntactical analysis
- Parsers have excellent error reporting out of the box
- Based on parsing expression grammar formalism — more powerful than traditional LL(k) and LR(k) parsers
- Usable from browser, from the command line, or via JavaScript API
Compiler & Parser
Reviewed by Unknown
on
06:46:00
Rating:
No comments: