Implementing a Multilingual Lexical Analyser for Java, C and C++
Lexical analyzers are important components of compilers and interpreters for coding languages such as C, Java, and C++. It acts as the first stage of the compiler, transforming the source code into a sequence of tokens. Such tokens, the smallest relevant parts of the program, are then applied to the phases of compiling. The C, C++ and Java lexical analyzer handles language-specific structures like identifiers, keywords, operators, and literals. The variations in syntax and semantics can be observed among these languages but the main conceptions in lexical analysis remain the same. This paper presents the implementation and design of a lexical analyzer for C, C++, and Java. When given a file containing code in any of these languages, the system analyzes the file’s content and classifies all the tokens into a category of identifiers, keywords, strings, numbers, symbols, operators, etc., and stores the token and token category in a symbol table and displays the table as the output and gives an error message if there are any syntax errors in the file.
Authors
- Niharika Panda (ORCID: https://orcid.org/0009-0002-4829-5189)
- S. Muthukumar
- Nagasarapu Sarayu Krishna
- Bhavika Gandham
- Trisha Vijayekkumaran
Institutions
- Amrita Vishwa Vidyapeetham (IN)
Publication Details
- Published
- 2024-10-04
- DOI
- https://doi.org/10.1109/gcat62922.2024.10923959
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00