Binder refactoring - extracted TCO - WIP
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -25,7 +25,8 @@ uses
|
||||
Myc.Ast.Binding.Nodes in '..\Src\AST\Myc.Ast.Binding.Nodes.pas',
|
||||
Myc.Ast.MacroExpander in '..\Src\AST\Myc.Ast.MacroExpander.pas',
|
||||
Myc.Ast.TypeChecker in '..\Src\AST\Myc.Ast.TypeChecker.pas',
|
||||
Myc.Ast.Lowering in '..\Src\AST\Myc.Ast.Lowering.pas';
|
||||
Myc.Ast.Lowering in '..\Src\AST\Myc.Ast.Lowering.pas',
|
||||
Myc.Ast.Compiler.TCO in '..\Src\AST\Myc.Ast.Compiler.TCO.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@
|
||||
<DCCReference Include="..\Src\AST\Myc.Ast.MacroExpander.pas"/>
|
||||
<DCCReference Include="..\Src\AST\Myc.Ast.TypeChecker.pas"/>
|
||||
<DCCReference Include="..\Src\AST\Myc.Ast.Lowering.pas"/>
|
||||
<DCCReference Include="..\Src\AST\Myc.Ast.Compiler.TCO.pas"/>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
|
||||
@@ -41,6 +41,7 @@ uses
|
||||
Myc.Ast.MacroExpander,
|
||||
Myc.Ast.TypeChecker,
|
||||
Myc.Ast.Lowering,
|
||||
Myc.Ast.Compiler.TCO,
|
||||
FMX.DialogService,
|
||||
FMX.ListView.Types,
|
||||
FMX.ListView.Appearances,
|
||||
@@ -214,7 +215,7 @@ end;
|
||||
function TForm1.CompileAst(const ANode: IAstNode; const AParentScope: IExecutionScope; out ADescriptor: IScopeDescriptor): IAstNode;
|
||||
var
|
||||
macroDescriptor: IScopeDescriptor;
|
||||
expandedAst, boundAst, typedAst: IAstNode;
|
||||
expandedAst, boundAst, typedAst, loweredAst: IAstNode;
|
||||
begin
|
||||
// Step 1: Expand macros (Phase 1)
|
||||
expandedAst := TMacroExpander.ExpandMacros(AParentScope, ANode, macroDescriptor, CreateEvaluator);
|
||||
@@ -226,7 +227,10 @@ begin
|
||||
typedAst := TTypeChecker.CheckTypes(boundAst, ADescriptor);
|
||||
|
||||
// Step 4: Lowering / Canonicalization (Phase 4)
|
||||
Result := TAstLowerer.Lower(typedAst);
|
||||
loweredAst := TAstLowerer.Lower(typedAst);
|
||||
|
||||
// Step 5: Tail Call Optimization (Phase 5)
|
||||
Result := TAstTCO.Optimize(loweredAst);
|
||||
end;
|
||||
|
||||
function TForm1.ExecuteAst(const ANode: IAstNode; const AParentScope: IExecutionScope): TDataValue;
|
||||
|
||||
Reference in New Issue
Block a user