unit Myc.Ast.Attributes; interface uses system.sysutils; type { Defines the content type for the LLM schema generation. } TFieldKind = ( fkNode, // Node (recursive structure) fkIdentifier, // Identifier ["Id", "name"] fkKeyword, // Keyword literal ["Key", "name"] fkLambda, // Lambda definition ["Fn", [...], body] fkTuple, // Tuple (explicit ["Tuple", [...]] structure) fkString, // Raw String (for identifiers/names) fkValue, // TDataValue (primitive constants like number, string, boolean) fkNullableNode, // Optional Node ('AstNode | null') fkArrayOfNodes, // Raw Array of Nodes (used inside Tuple) fkArrayOfPairs, // Special structure for CondExpr: [[Cond, Branch], ...] fkArrayOfKeys, // Special structure for an array of keywords fkPipeInputs // Specific structure: ["Tuple", [ ["Tuple", [Id, Tuple]], ... ]] ); { AstTagAttribute: Defines the JSON Tag for an AST Node. } AstTagAttribute = class(TCustomAttribute) private FTag: string; public constructor Create(const ATag: string); property Tag: string read FTag; end; { AstFieldAttribute: Defines a field within the JSON Array. } AstFieldAttribute = class(TCustomAttribute) private FName: string; FKind: TFieldKind; FIndex: Integer; public constructor Create(AIndex: Integer; const AName: string; AKind: TFieldKind); property Index: Integer read FIndex; property Name: string read FName; property Kind: TFieldKind read FKind; end; { AstDocAttribute: Provides semantic documentation for the LLM. } AstDocAttribute = class(TCustomAttribute) private FDescription: string; public constructor Create(const ADescription: string); property Description: string read FDescription; end; { AstScriptExampleAttribute: Provides an example in script syntax. The generator converts this to JSON AST for the LLM prompt. } AstScriptExampleAttribute = class(TCustomAttribute) private FScript: string; public constructor Create(const AScript: string); property Script: string read FScript; end; { AstSignatureAttribute: Defines a specific overload signature for an RTL function. } AstSignatureAttribute = class(TCustomAttribute) private FSignature: string; public constructor Create(const ASignature: string); property Signature: string read FSignature; end; implementation { AstTagAttribute } constructor AstTagAttribute.Create(const ATag: string); begin inherited Create; FTag := ATag; end; { AstFieldAttribute } constructor AstFieldAttribute.Create(AIndex: Integer; const AName: string; AKind: TFieldKind); begin inherited Create; FIndex := AIndex; FName := AName; FKind := AKind; end; { AstDocAttribute } constructor AstDocAttribute.Create(const ADescription: string); begin inherited Create; FDescription := ADescription; end; { AstScriptExampleAttribute } constructor AstScriptExampleAttribute.Create(const AScript: string); begin inherited Create; FScript := AScript; end; { AstSignatureAttribute } constructor AstSignatureAttribute.Create(const ASignature: string); begin inherited Create; FSignature := ASignature; end; end.