Lexical Analysis: A C-Based Scanner and Recursive-Descent Parser
The program is an implementation of a scanner and a
recursive-descent parser for a custom language, Yoshi⋅Island⋅Lang,
written in C.
It performs the following key tasks:
Lexical Analysis (Scanner): The scanner reads the source code as a
sequence of characters and groups them into meaningful units
called tokens (e.g., identifiers, keywords, numbers, operators,
delimiters). It handles common language features like whitespace,
comments, and invalid input while ensuring valid tokens are passed
to the parser. The scanner uses C-strings (character arrays) for
efficient tokenization, showcasing low-level string manipulation.
Syntax Analysis (Parser): The parser uses the recursive-descent
technique, a top-down parsing method, to process the tokens
generated by the scanner. It validates the syntax of the program
against the formal grammar of Yoshi⋅Island⋅Lang. The parser builds
a parse tree or simply checks if the input is syntactically
correct, identifying and reporting any errors encountered during
parsing.
Error Reporting: Both the scanner and parser include mechanisms
for error detection and reporting, such as invalid characters in
the input or syntax violations. Code Structure: The program is
modular, with separate functions handling different grammar rules,
making it easy to extend or modify. Comments and clearly defined
functions outline the grammar rules and logic implemented,
providing a roadmap of the language's syntax. This program not
only demonstrates a strong grasp of lexical and syntax analysis
but also offers insights into low-level programming techniques,
emphasizing precision and efficiency.
Las Vegas, Nevada
(951) 454-5593
athertonharrison@gmail.com