loading...
Cover image for JS compiled language

JS compiled language

giandodev profile image GiandoDev ・1 min read

The history teaches us that the compiler processes the code in three stages:

Lexing

Alt Text
As in the image above, in this phase, we convert our program into meaningful tokens.

Parsing

Here we take a stream of tokens (array) and trasform it into an abstract syntax tree called AST that represent the grammatical structure of the program.
Alt Text

Code Generation

Here JavaScript convert AST into a set of machine instruction.
Between parsing and code generation, JavaScript optimizes performance, execution and does also other cool stuff, all in a millisecond.
If you want take time to understand JavaScript engines look this awesome video from JS config Franziska Hinkelmann
Alt Text

Posted on May 23 by:

giandodev profile

GiandoDev

@giandodev

Hi, I am Giandomenico. I love to learn new stuff and solve problems.

Discussion

markdown guide