LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How do compilers work?

I want to know how do compilers work. Can anyone please help me out.

Up Vote Down Vote 0 Votes
Posted 2 months ago

Answers


Working of compiler- JavaScript is considered to be a language having high level of flexibility and readable by human. A compiler transforms that code into a form that is readable by machine. JavaScript compiler works in a 4 step process

  • A scanner scans the code which is then converted into tokens. This process is done using regular expression.
  • The tokenized code is then parsed where its scope and structure is encoded into a syntax tree.
  • The tree structure is passed through translator where it is converted into equivalent bytecode.
  • The final phase is performed by the byte code interpreter which turns the byte code into native code and renders it in the browser
Up Vote Down Vote 0 Votes
Posted 2 months ago