nightshade

The nightshade programming language, compiler and tools (WIP)
Log | Files | Refs | README

commit d7b977c93e7ddb7f3c48fe69dc0e56b5ab79ed36
parent fa78956b1f887e5aab7a00245401c6f29401fdf4
Author: citbl <citbl@citbl.org>
Date:   Sun, 14 Jun 2026 22:37:46 +1000

refac

Diffstat:
Msrc/nightshade.adb | 14+++++++-------
Msrc/parser.adb | 4++--
Msrc/parser.ads | 10+++++-----
Msrc/scope.adb | 4++--
Msrc/scope.ads | 4++--
5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/nightshade.adb b/src/nightshade.adb @@ -28,17 +28,17 @@ begin P : Parser.Parser := Parser.Init (File_Name_Ref, Src_Ref, L.Tokens); begin Parser.Parse (P); - Utils.Print_AST (P.Declarations); + Utils.Print_AST (P.AST); declare - BoundAST : Scope.Scoper := Scope.Init (P.Declarations); + Scoper : Scope.Scoper := Scope.Init (P.AST); begin - Scope.Analysis (BoundAST); - Utils.Print_AST (BoundAST.AST); - declare - TypedAST : Typing.Typer := Typing.Init(P.Declarations); + Scope.Analysis (Scoper); + Utils.Print_AST (Scoper.Scoped_AST); + declare + TypedAST : Typing.Typer := Typing.Init (P.AST); begin - Typing.Type_Check(TypedAST); + Typing.Type_Check (TypedAST); end; end; end; diff --git a/src/parser.adb b/src/parser.adb @@ -15,7 +15,7 @@ package body Parser is File_Name => File_Name, Tokens => Tokens, Pos => 1, - Declarations => Declaration_Vectors.Empty_Vector); + AST => Declaration_Vectors.Empty_Vector); begin return P; end; @@ -255,7 +255,7 @@ package body Parser is exit when T.Kind = EOF or (T.Kind = Keyword and T.Lexeme = "end"); end loop; - P.Declarations := TL; + P.AST := TL; Put_Line ("done parsing"); end; diff --git a/src/parser.ads b/src/parser.ads @@ -4,11 +4,11 @@ with Types; use Types; package Parser is type Parser is record - Source : Source_Ref; - File_Name : File_Name_Ref; - Tokens : Types.Token_Vector.Vector; - Declarations : Declaration_Vectors.Vector; - Pos : Positive; + Source : Source_Ref; + File_Name : File_Name_Ref; + Tokens : Types.Token_Vector.Vector; + AST : Declaration_Vectors.Vector; + Pos : Positive; end record; function Init diff --git a/src/scope.adb b/src/scope.adb @@ -22,7 +22,7 @@ package body Scope is S : Scoper; begin Sc := new AST_Scope'(Parent => null, Symbols => Symbols); - S := (Scope => Sc, AST => AST); + S := (Scope => Sc, Scoped_AST => AST); Load_STD_Symbols (S); return S; end Init; @@ -174,7 +174,7 @@ package body Scope is procedure Analysis (S : in out Scoper) is begin - for Declaration of S.AST loop + for Declaration of S.Scoped_AST loop if Declaration.Kind = Function_Kind then Declaration.Scope := S.Scope; Put_Line ("scoping function"); diff --git a/src/scope.ads b/src/scope.ads @@ -6,8 +6,8 @@ with Types; use Types; package Scope is type Scoper is record - Scope : AST_Scope_Ref; - AST : Declaration_Vectors.Vector; + Scope : AST_Scope_Ref; + Scoped_AST : Declaration_Vectors.Vector; end record; Int_Type : constant AST_Type_Info_Ref := new AST_Type_Info'(Kind => TY_INT);