Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Compiler_Lexer.H File Reference

Lexical analyzer (Lexer) based on Source_Manager. More...

#include <cctype>
#include <string>
#include <Compiler_Token.H>
#include <ah-diagnostics.H>
Include dependency graph for Compiler_Lexer.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Compiler_Lexer_Options
 Configuration options for lexer behavior. More...
 
class  Aleph::Compiler_Lexer
 Token generator for a single source file. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Detailed Description

Lexical analyzer (Lexer) based on Source_Manager.

The lexer is the first component of the front-end. Its mission is to transform a stream of characters from a source file into a sequence of Compiler_Token objects with semantic meaning.

Responsibilities:

  • Skip whitespace and (optionally) comments.
  • Classify identifiers and keywords.
  • Parse numeric, string, and character literals, managing escape sequences.
  • Emit readable diagnostics for lexical errors (e.g., unterminated strings).

Typical Usage:

Compiler_Lexer lexer(source_manager, file_id, diag_engine);
while (!lexer.eof()) {
Compiler_Token tok = lexer.next();
// Process token...
}

Definition in file Compiler_Lexer.H.