This repository hosts the comprehensive design and implementation of a JavaScript compiler. It covers fundamental stages including lexical analysis, syntactic analysis, and semantic analysis. Additionally, it features robust symbol table management and a proficient error-handling system. In addition to handling foundational expressions, it also offers recognition for the following advanced elements:
- For loop
- Subtraction assignment
- Block comment
- Double commas
-
Lexical Analysis: This phase involves the identification of keywords, identifiers, operators, and various code constructs.
-
Syntactic Analysis: Following tokenization, the process of syntactic analysis ensues, where the token stream undergoes stringent examination to ascertain adherence to the stipulated grammar rules of the language. Recursive descent technique is used.
-
Semantic Analysis: With syntactic validity confirmed, the compiler delves into semantic analysis, guaranteeing the coherence of the code's intent, precluding undeclared variable usage, and ensuring compatibility of types.
-
Symbol Table Management: To track identifiers and their attributes, the compiler employs an efficient symbol table. This repository of information facilitates seamless reference and management of variables throughout the code.
-
Error Handling Excellence: A vital aspect of compiler robustness is our error-handling infrastructure, adept at identifying, reporting, and managing errors with poise, ensuring a graceful user experience.