Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Compiler_Frontend Class Referenceabstract

Abstract language frontend that can feed reusable drivers. More...

#include <Compiler_Frontend.H>

Inheritance diagram for Aleph::Compiler_Frontend:
[legend]

Public Member Functions

virtual ~Compiler_Frontend ()=default
 
virtual const char * name () const noexcept=0
 Returns a stable user-facing frontend name.
 
virtual void clear () noexcept=0
 Clears all frontend-owned state from the previous run.
 
virtual bool load_sources (const DynArray< Compiler_Driver_Source > &inputs)=0
 Registers the ordered input sources for the next run.
 
virtual bool parse ()=0
 Parses all previously loaded sources.
 
virtual bool analyze ()=0
 Runs semantic analysis on the parsed program.
 
virtual bool lower_hir ()=0
 Lowers the analyzed program into common HIR.
 
virtual bool lower_ir ()=0
 Lowers the analyzed program into common IR.
 
virtual Diagnostic_Engine * diagnostic_engine () noexcept=0
 Returns the diagnostic engine populated by the frontend.
 
virtual const Diagnostic_Engine * diagnostic_engine () const noexcept=0
 Returns the diagnostic engine populated by the frontend.
 
virtual const Compiler_Type_Context * type_context () const noexcept=0
 Returns the optional shared type context for dumps and backends.
 
virtual const Compiler_HIR_Module * hir_module () const noexcept=0
 Returns the lowered HIR module from the last run, when available.
 
virtual const Compiler_IR_Module * ir_module () const noexcept=0
 Returns the lowered IR module from the last run, when available.
 
virtual const DynArray< Compiler_Module_Descriptor > & module_descriptors () const noexcept
 Returns parsed module descriptors for reusable import orchestration.
 
virtual const DynArray< size_t > & module_merge_order () const noexcept
 Returns the dependency-first merge order from the last parse.
 
virtual const DynArray< Compiler_Module_Metadata > & module_metadata () const noexcept
 Returns reusable metadata for the top-level surface of each module.
 
virtual const DynArray< Compiler_Driver_Artifact > & artifacts () const noexcept=0
 Returns all frontend-produced artifacts from the last run.
 
virtual const Compiler_Driver_Artifact * find_artifact (std::string_view label) const noexcept=0
 Finds one frontend artifact by exact label.
 
virtual const DynArray< std::string > & errors () const noexcept=0
 Returns hard frontend-level errors outside the diagnostic engine.
 
virtual const DynArray< std::string > & warnings () const noexcept=0
 Returns non-fatal frontend-level warnings.
 

Detailed Description

Abstract language frontend that can feed reusable drivers.

Definition at line 57 of file Compiler_Frontend.H.

Constructor & Destructor Documentation

◆ ~Compiler_Frontend()

virtual Aleph::Compiler_Frontend::~Compiler_Frontend ( )
virtualdefault

Member Function Documentation

◆ analyze()

virtual bool Aleph::Compiler_Frontend::analyze ( )
pure virtual

Runs semantic analysis on the parsed program.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_sources().

◆ artifacts()

virtual const DynArray< Compiler_Driver_Artifact > & Aleph::Compiler_Frontend::artifacts ( ) const
pure virtualnoexcept

Returns all frontend-produced artifacts from the last run.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::collect_frontend_state().

◆ clear()

virtual void Aleph::Compiler_Frontend::clear ( )
pure virtualnoexcept

Clears all frontend-owned state from the previous run.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::clear().

◆ diagnostic_engine() [1/2]

virtual const Diagnostic_Engine * Aleph::Compiler_Frontend::diagnostic_engine ( ) const
pure virtualnoexcept

Returns the diagnostic engine populated by the frontend.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

◆ diagnostic_engine() [2/2]

virtual Diagnostic_Engine * Aleph::Compiler_Frontend::diagnostic_engine ( )
pure virtualnoexcept

◆ errors()

virtual const DynArray< std::string > & Aleph::Compiler_Frontend::errors ( ) const
pure virtualnoexcept

Returns hard frontend-level errors outside the diagnostic engine.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::collect_frontend_state().

◆ find_artifact()

◆ hir_module()

virtual const Compiler_HIR_Module * Aleph::Compiler_Frontend::hir_module ( ) const
pure virtualnoexcept

Returns the lowered HIR module from the last run, when available.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_hir_runtime().

◆ ir_module()

virtual const Compiler_IR_Module * Aleph::Compiler_Frontend::ir_module ( ) const
pure virtualnoexcept

Returns the lowered IR module from the last run, when available.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::emit_c(), and Aleph::Compiler_Generic_Driver::lower_bytecode().

◆ load_sources()

virtual bool Aleph::Compiler_Frontend::load_sources ( const DynArray< Compiler_Driver_Source > &  inputs)
pure virtual

Registers the ordered input sources for the next run.

Parameters
inputsInput sources to register in frontend-specific storage.
Returns
true if the inputs are acceptable.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_sources().

◆ lower_hir()

virtual bool Aleph::Compiler_Frontend::lower_hir ( )
pure virtual

Lowers the analyzed program into common HIR.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_sources().

◆ lower_ir()

virtual bool Aleph::Compiler_Frontend::lower_ir ( )
pure virtual

Lowers the analyzed program into common IR.

Implementations may lower from HIR or directly from language-specific semantic state, as long as the resulting Compiler_IR_Module follows the public IR contracts.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_sources().

◆ module_descriptors()

◆ module_merge_order()

virtual const DynArray< size_t > & Aleph::Compiler_Frontend::module_merge_order ( ) const
inlinevirtualnoexcept

◆ module_metadata()

virtual const DynArray< Compiler_Module_Metadata > & Aleph::Compiler_Frontend::module_metadata ( ) const
inlinevirtualnoexcept

Returns reusable metadata for the top-level surface of each module.

Until the platform grows explicit export syntax, frontends typically map this to all top-level declarations that the module contributes.

Reimplemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Definition at line 150 of file Compiler_Frontend.H.

Referenced by Aleph::Compiler_Generic_Driver::record_module_bindings_artifact(), Aleph::Compiler_Generic_Driver::record_module_linkage_artifact(), Aleph::Compiler_Generic_Driver::record_module_metadata_artifact(), Aleph::Compiler_Generic_Driver::record_module_name_table_artifact(), and Aleph::Compiler_Generic_Driver::record_module_semantic_environment_artifact().

◆ name()

virtual const char * Aleph::Compiler_Frontend::name ( ) const
pure virtualnoexcept

Returns a stable user-facing frontend name.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

◆ parse()

virtual bool Aleph::Compiler_Frontend::parse ( )
pure virtual

Parses all previously loaded sources.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::execute_sources().

◆ type_context()

virtual const Compiler_Type_Context * Aleph::Compiler_Frontend::type_context ( ) const
pure virtualnoexcept

Returns the optional shared type context for dumps and backends.

Frontends that do not use Compiler_Types.H may return nullptr.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::lower_bytecode().

◆ warnings()

virtual const DynArray< std::string > & Aleph::Compiler_Frontend::warnings ( ) const
pure virtualnoexcept

Returns non-fatal frontend-level warnings.

Implemented in Aleph::Compiler_Line_Frontend, and Aleph::Compiler_MVP_Frontend.

Referenced by Aleph::Compiler_Generic_Driver::collect_frontend_state().


The documentation for this class was generated from the following file: