61 lines
961 B
C#
61 lines
961 B
C#
// Copyright (c) StellaOps. All rights reserved.
|
|
// Licensed under BUSL-1.1. See LICENSE in the project root.
|
|
using System.Collections.Immutable;
|
|
|
|
namespace StellaOps.BinaryIndex.Decompiler;
|
|
|
|
/// <summary>
|
|
/// Abstract syntax tree node.
|
|
/// </summary>
|
|
public abstract record AstNode(
|
|
AstNodeType Type,
|
|
ImmutableArray<AstNode> Children,
|
|
SourceLocation? Location);
|
|
|
|
/// <summary>
|
|
/// Types of AST nodes.
|
|
/// </summary>
|
|
public enum AstNodeType
|
|
{
|
|
// Structure
|
|
Function,
|
|
Block,
|
|
Parameter,
|
|
|
|
// Control flow
|
|
If,
|
|
While,
|
|
For,
|
|
DoWhile,
|
|
Switch,
|
|
Case,
|
|
Default,
|
|
Return,
|
|
Break,
|
|
Continue,
|
|
Goto,
|
|
Label,
|
|
|
|
// Expressions
|
|
Assignment,
|
|
BinaryOp,
|
|
UnaryOp,
|
|
TernaryOp,
|
|
Call,
|
|
Cast,
|
|
Sizeof,
|
|
|
|
// Operands
|
|
Variable,
|
|
Constant,
|
|
StringLiteral,
|
|
ArrayAccess,
|
|
FieldAccess,
|
|
PointerDeref,
|
|
AddressOf,
|
|
|
|
// Declarations
|
|
VariableDecl,
|
|
TypeDef
|
|
}
|