Class: Highway::Compiler::Suite
- Inherits:
-
Object
- Object
- Highway::Compiler::Suite
- Defined in:
- lib/highway/compiler/suite.rb
Overview
This class is responsible for executing all compiler stages, including syntactic analysis, semantic analysis and manifest generation.
Instance Method Summary collapse
-
#compile(path:, preset:) ⇒ Highway::Compiler::Build::Output::Manifest
Run the compiler suite.
-
#initialize(registry:, interface:) ⇒ Suite
constructor
Initialize an instance.
Constructor Details
#initialize(registry:, interface:) ⇒ Suite
Initialize an instance.
23 24 25 26 |
# File 'lib/highway/compiler/suite.rb', line 23 def initialize(registry:, interface:) @registry = registry @interface = interface end |
Instance Method Details
#compile(path:, preset:) ⇒ Highway::Compiler::Build::Output::Manifest
Run the compiler suite.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/highway/compiler/suite.rb', line 34 def compile(path:, preset:) @interface.header_success("Compiling the configuration file...") parser = Parse::Parser.new(interface: @interface) parse_tree = parser.parse(path: path) analyzer = Analyze::Analyzer.new(registry: @registry, interface: @interface) sema_tree = analyzer.analyze(parse_tree: parse_tree) builder = Build::Builder.new(interface: @interface) manifest = builder.build(sema_tree: sema_tree, preset: preset) @interface.success("Successfully compiled the configuration file.") manifest end |