You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here’s a comprehensive list of possible Abstract Syntax Tree (AST) node types that are generic and can be applied to various programming languages like Python, Rust, or JavaScript. Each node type is categorized as either a statement (Stmt) or an expression (Expr) where necessary.
1. Program Structure
Program - Represents a program.
Package - Represents a package.
Module - Represents a module or a source file
Block - A block of statements (commonly used in function bodies, loops, etc.).
TypeCheckExpr - Represents a type check operation (e.g., isinstance in Python).
9. Object-Oriented Constructs
NewExpr - Represents object instantiation (e.g., new in JavaScript).
MethodCallExpr - Represents a method call (e.g., obj.method()).
ThisExpr - Represents the current instance (e.g., this in JavaScript).
SuperExpr - Represents the superclass reference (e.g., super in Python).
10. Memory Management
AllocExpr - Represents memory allocation (e.g., malloc in C).
DeallocStmt - Represents memory deallocation (e.g., free in C).
11. Miscellaneous
CommentStmt - Represents a comment.
DocStringStmt - Represents a documentation string (common in Python).
12. Meta
MetaExpr - Represents meta-programming constructs (like macros in Rust).
These node types cover a wide range of constructs found in various programming languages. Depending on the language, some of these node types might be more specific, and their usage might vary. This list should give you a solid foundation to model AST nodes generically across different programming paradigms.
It is not clear yet what would be a better solution for handling stmt and expr classes/types.
some alternatives (examples):
expr.flows.IfExpr
expr.flows.If
flows.expr.If
flows.expr.IfExpr
flows.IfExpr
stmt.flows.If
stmt.flows.IfStmt
stmt.flows.If
flows.stmt.IfStmt
flows.stmt.If
flows.IfStmt
The text was updated successfully, but these errors were encountered:
Here’s a comprehensive list of possible Abstract Syntax Tree (AST) node types that are generic and can be applied to various programming languages like Python, Rust, or JavaScript. Each node type is categorized as either a statement (
Stmt
) or an expression (Expr
) where necessary.1. Program Structure
Program
- Represents a program.Package
- Represents a package.Module
- Represents a module or a source fileBlock
- A block of statements (commonly used in function bodies, loops, etc.).ImportStmt
/ImportFromStmt
- Represents an import statement. #87ImportExpr
/ImportFromExpr
- Represents an import expression. #882. Declarations
VariableDeclarationStmt
- Declares a variable.ConstantDeclarationStmt
- Declares a constant.FunctionDeclarationStmt
- Declares a function.ClassDeclStmt
/ClassDefStmt
- Declares and defines a class. #90StructDeclStmt
,StructDefStmt
- Declares and Define a structure (e.g., in Rust). #92EnumDeclStmt
/EnumDefStmt
- Declares and Definition of an enumeration. #913. Expressions
VariableExpr
- Represents a variable.LiteralExpr
- Represents a literal value (e.g., number, string, boolean).BinaryOpExpr
- Represents a binary operation (e.g., addition, subtraction).UnaryOpExpr
- Represents a unary operation (e.g., negation).FunctionCallExpr
- Represents a function call.MemberAccessExpr
- Accesses a member of a structure or class (e.g.,obj.field
). #97IndexExpr
- Indexing into a list or array (e.g.,arr[index]
). #98AssignmentExpr
- Assigns a value to a variable. #89IfExpr
- Represents an if expression (e.g., in Rust). #93MatchExpr
- Represents a match or switch expression (common in Rust and Swift). #99TupleExpr
- Represents a tuple expression.ArrayExpr
- Represents an array or list expression.DictExpr
- Represents a dictionary or map expression.WhileExpr
- Represents a while loop. #96ForRangeExpr
- Represents a for range loop. #94ForCounterExpr
- Represents a for counter loop. #954. Statements
AssignmentStatement
- Assigns a value to a variable.ExpressionStmt
- A statement that evaluates an expression (common in JavaScript, Python).ReturnStmt
- Represents a return statement.BreakStmt
- Represents a break statement (used to exit loops).ContinueStmt
- Represents a continue statement (skips the rest of the loop iteration).IfStmt
- Represents an if statement.ElseStmt
- Represents an else statement (paired withIfStmt
).ElseIfStmt
- Represents an else-if statement (used in Python, JavaScript).MatchStmt
- Represents a match or switch statement.WhileStmt
- Represents a while loop.ForRangeStmt
- Represents a for range loop.ForCounterStmt
- Represents a for counter loop.ForEachStmt
- Represents a for each loop.DoWhileStmt
- Represents a do-while loop.ThrowStmt
- Represents a throw statement (for exceptions). #100TryStmt
- Represents a try block. #101CatchStmt
- Represents a catch block. #102FinallyStmt
- Represents a finally block (used with try-catch). #103AssertStmt
- Represents an assert statement.PassStmt
- Represents a pass statement (no-op, common in Python).5. Functionality
Parameter
- Represents a function or method parameter.LambdaExpr
- Represents a lambda or anonymous function expression. #104ClosureExpr
- Represents a closure expression (capturing variables from the environment). #1056. Control Flow
GotoStmt
- Represents a goto statement (less common in modern languages). #106LabelStmt
- Represents a label in conjunction withGotoStmt
.YieldExpr
- Represents a yield expression (common in Python for generators). #107AwaitExpr
/AsyncFunction
- Represents an await expression (common in async programming). #1087. Error Handling
TryCatchStmt
- A combined try-catch statement (sometimes considered separately asTryStmt
andCatchStmt
).ThrowExpr
- Represents a throw expression (for exceptions).RaiseStmt
- Represents a raise statement (specific to Python).8. Types and Casting
TypeExpr
- Represents a type expression (e.g., int, string, custom types). #109TypeCastExpr
- Represents a type casting operation. #110TypeCheckExpr
- Represents a type check operation (e.g.,isinstance
in Python).9. Object-Oriented Constructs
NewExpr
- Represents object instantiation (e.g.,new
in JavaScript).MethodCallExpr
- Represents a method call (e.g.,obj.method()
).ThisExpr
- Represents the current instance (e.g.,this
in JavaScript).SuperExpr
- Represents the superclass reference (e.g.,super
in Python).10. Memory Management
AllocExpr
- Represents memory allocation (e.g.,malloc
in C).DeallocStmt
- Represents memory deallocation (e.g.,free
in C).11. Miscellaneous
CommentStmt
- Represents a comment.DocStringStmt
- Represents a documentation string (common in Python).12. Meta
MetaExpr
- Represents meta-programming constructs (like macros in Rust).These node types cover a wide range of constructs found in various programming languages. Depending on the language, some of these node types might be more specific, and their usage might vary. This list should give you a solid foundation to model AST nodes generically across different programming paradigms.
It is not clear yet what would be a better solution for handling stmt and expr classes/types.
some alternatives (examples):
expr.flows.IfExpr
expr.flows.If
flows.expr.If
flows.expr.IfExpr
flows.IfExpr
stmt.flows.If
stmt.flows.IfStmt
stmt.flows.If
flows.stmt.IfStmt
flows.stmt.If
flows.IfStmt
The text was updated successfully, but these errors were encountered: