-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AST Restructuring & Mapping Update #507
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This primarily helps improve security by having more strict type inference and clearness navigating the code, as things should be more directly accessible now. In addition with the improved mapping of kind ids and rule names the connection between the AST and the parser is more streamlined and clear.
These semantic data and type data interfaces are now grouped together with their corresponding AST node in their own directory. This is to help make the AST structure more clear and finish the AST update.
Luna-Klatzer
added
feature
New feature or enhancement
other
Other development related change or issue
labels
Oct 17, 2023
Codecov ReportAttention:
📢 Thoughts on this report? Let us know!. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of change does this PR perform?
Summary
Cleaned up internal AST structure and added additional mapping functionality, allowing more seamless mappings between
kind
andruleName
, and their associated AST class.Summary of Changes
ASTNodeMapper
for handling mappings.@kipper/core
.ruleName
for all AST node classes.Does this PR create new warnings?
No.
Detailed Changelog
Not present for website/docs changes
kipper/core/tools
, which contains all tools and utilities used by the compiler.kipper/core/tools/decorators
, which contains all decorators used by the compiler.kipper/core/tools/functions
, which contains all functions used by the compiler.kipper/core/tools/types
, which contains all types used by the compiler.kipper/core/compiler/ast/common
, which contains commonly used types and functions.kipper/core/compiler/ast/factories
, which replaces the old filefactories.ts
and contains all AST factoryclasses and types.
kipper/core/compiler/ast/mapping
, which contains all AST mapping objects and theASTNodeMapper
class.ASTNodeMapper
, which handles the mapping between kind numbers, rule names, AST classes and parser context classes.PrimaryExpression
, which is an abstract base class for all primary expressions.PostfixExpression
, which is an abstract base class for all postfix expressions.PrimaryExpressionSemantics
, which represents the semantics of a primary expression.PrimaryExpressionTypeSemantics
, which represents the type semantics of a primary expression.PostfixExpressionSemantics
, which represents the semantics of a postfix expression.PostfixExpressionTypeSemantics
, which represents the type semantics of a postfix expression.IterationStatementTypeSemantics
, which represents the type semantics of an iteration statement.ExpressionStatementSemantics
, which represents the semantics of an expression statement.ExpressionStatementTypeSemantics
, which represents the type semantics of an expression statement.StatementSemantics
, which represents the semantics of a statement.StatementTypeSemantics
, which represents the type semantics of a statement.IfStatementTypeSemantics
, which represents the type semantics of an if statement.CompoundStatementSemantics
, which represents the semantics of a compound statement.CompoundStatementTypeSemantics
, which represents the type semantics of a compound statement.ForLoopStatementTypeSemantics
, which represents the type semantics of a for loop statement.DoWhileLoopIterationStatementTypeSemantics
, which represents the type semantics of a do-while loop statement.WhileLoopStatementTypeSemantics
, which represents the type semantics of a while loop statement.JumpStatementTypeSemantics
, which represents the type semantics of a jump statement.SwitchStatementSemantics
, which represents the semantics of a switch statement.SwitchStatementTypeSemantics
, which represents the type semantics of a switch statement.ParserASTNode.ruleName
, which contains the rule name of the node.KipperTargetBuiltInGenerator.voidToStr()
, for the built-in conversion fromvoid
tostr
.KipperTargetBuiltInGenerator.nullToStr()
, for the built-in conversion fromnull
tostr
.KipperTargetBuiltInGenerator.undefinedToStr()
, for the built-in conversion fromundefined
tostr
.replaceObjKeys()
, which replaces the keys of an object with the values returned by a function.inverseMap()
, which inverts a map by swapping the keys and values.Changed
FunctionCallPostfixTypeSemantics
toFunctionCallExpressionTypeSemantics
.FStringPrimaryExpressionSemantics.items
toatoms
.getTSFunction()
togenTSFunction()
.typeSpecifier
totypeSpecifierExpression
and its AST classTypeSpecifier
toTypeSpecifierExpression
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.identifierTypeSpecifier
toidentifierTypeSpecifierExpression
and its AST classIdentifierTypeSpecifier
toIdentifierTypeSpecifierExpression
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.genericTypeSpecifier
togenericTypeSpecifierExpression
and its AST classGenericTypeSpecifier
toGenericTypeSpecifierExpression
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.typeofTypeSpecifier
totypeofTypeSpecifierExpression
and its AST classTypeofTypeSpecifier
toTypeofTypeSpecifierExpression
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.forLoopStatement
toforLoopIterationStatement
and its AST classForLoopStatement
toForLoopIterationStatement
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.whileLoopStatement
towhileLoopIterationStatement
and its AST classWhileLoopStatement
toWhileLoopIterationStatement
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.doWhileLoopStatement
todoWhileLoopIterationStatement
and its AST classDoWhileLoopStatement
toDoWhileLoopIterationStatement
. This also includes changing the name in theKipperTargetCodeGenerator
,KipperTargetSemanticAnalyser
andKipperTargetBuiltInGenerator
classes.kipper/core/compiler/parser/parser-ast-mapping.ts
toparse-rule-kind-mappings.ts
.ArrayLiteralPrimaryExpression
toArrayPrimaryExpression
.ArrayLiteralPrimaryExpressionSemantics
toArrayPrimaryExpressionSemantics
.ArrayLiteralPrimaryExpressionTypeSemantics
toArrayPrimaryExpressionTypeSemantics
.TangledPrimaryTypeSemantics
toTangledPrimaryExpressionTypeSemantics
.DoWhileLoopStatementSemantics
toDoWhileLoopIterationStatementSemantics
.kipper/core/utils.ts
tokipper/core/tools
and separated it into multiple files & modules.kipper/core/compiler/ast/root-ast-node.ts
to thekipper/core/compiler/ast/nodes
module.kipper/core/compiler/ast/ast-types.ts
to the newkipper/core/compiler/ast/common
module.Linked issues or PRs
No linked issues.