ic10r-node 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,136 +0,0 @@
1
- // Copyright (c) 2026. All rights reserved.
2
- // This source code is licensed under the CC BY-NC-SA
3
- // (Creative Commons Attribution-NonCommercial-NoDerivatives) License, By Xiao Songtao.
4
- // This software is protected by copyright law. Reproduction, distribution, or use for commercial
5
- // purposes is prohibited without the author's permission. If you have any questions or require
6
- // permission, please contact the author: edocsitahw@qq.com
7
-
8
- /**
9
- * @file program.d.ts
10
- * @author edocsitahw
11
- * @version 1.1
12
- * @date 2026/07/22 15:52
13
- * @desc
14
- * @copyright CC BY-NC-SA 2026. All rights reserved.
15
- * */
16
- import {Pos} from "../common";
17
- import {LabelDefNode, PreprocessorDirectiveNode, ErrorNode} from "./ast";
18
- import {
19
- NullaryInstructionNode,
20
- UnaryInstructionNode,
21
- BinaryInstructionNode,
22
- TernaryInstructionNode,
23
- QuaternaryInstructionNode, QuinaryInstructionNode, SenaryInstructionNode
24
- } from "./instructions";
25
-
26
-
27
- /**
28
- * @summary 可执行指令联合类型
29
- *
30
- * @desc 包含所有可执行指令类型的联合,包括零元、一元、二元、三元、四元、五元和六元指令。
31
- * 这是 IC10 程序中所有可执行指令的完整集合。
32
- *
33
- * @elseif en
34
- * @summary Executable instruction union type
35
- *
36
- * @desc Union of all executable instruction types, including nullary, unary, binary, ternary, quaternary, quinary, and senary instructions.
37
- * This is the complete set of all executable instructions in IC10 programs.
38
- *
39
- * @public
40
- */
41
- export type ExecutableInstructionNode =
42
- | NullaryInstructionNode
43
- | UnaryInstructionNode
44
- | BinaryInstructionNode
45
- | TernaryInstructionNode
46
- | QuaternaryInstructionNode
47
- | QuinaryInstructionNode
48
- | SenaryInstructionNode;
49
-
50
- export type PureExeInstructionNode = Exclude<ExecutableInstructionNode, ErrorNode>;
51
-
52
- /**
53
- * @summary 语句联合类型
54
- *
55
- * @desc 包含 IC10 程序中所有语句类型的联合:
56
- * - 可执行指令({@link ExecutableInstructionNode})
57
- * - 标签定义({@link LabelDefNode})
58
- * - 预处理指令({@link PreprocessorDirectiveNode})
59
- *
60
- * @elseif en
61
- * @summary Statement union type
62
- *
63
- * @desc Union of all statement types in IC10 programs:
64
- * - Executable instructions ({@link ExecutableInstructionNode})
65
- * - Label definitions ({@link LabelDefNode})
66
- * - Preprocessor directives ({@link PreprocessorDirectiveNode})
67
- *
68
- * @public
69
- */
70
- export type StatementNode =
71
- | ExecutableInstructionNode
72
- | LabelDefNode
73
- | PreprocessorDirectiveNode;
74
-
75
-
76
- /**
77
- * @summary 程序节点类
78
- *
79
- * @desc 表示 IC10 程序的根节点。
80
- * 包含程序的所有语句和结束位置信息。
81
- *
82
- * @elseif en
83
- * @summary Program node class
84
- *
85
- * @desc Represents the root node of an IC10 program.
86
- * Contains all statements of the program and end position information.
87
- *
88
- * @example
89
- * ```typescript
90
- * // 解析 IC10 代码
91
- * const parser = new ic10.Parser(tokens);
92
- * const program = parser.parse();
93
- *
94
- * // 访问程序语句
95
- * console.log(`语句数量: ${program.statements.length}`);
96
- * ```
97
- *
98
- * @public
99
- */
100
- export class Program {
101
- /**
102
- * @summary 节点名称
103
- * @desc 通常为 "Program"
104
- */
105
- nodeName: string;
106
-
107
- /**
108
- * @summary 程序语句列表
109
- * @desc 包含程序中的所有语句(指令、标签、预处理指令等)
110
- */
111
- statements: StatementNode[];
112
-
113
- /**
114
- * @summary 结束位置
115
- * @desc 程序在源代码中的结束位置
116
- */
117
- end: Pos;
118
-
119
- /**
120
- * @summary 返回可读字符串表示
121
- *
122
- * @returns 格式化的程序字符串
123
- *
124
- * @desc 用于调试目的,返回人类可读的程序表示。
125
- */
126
- toString(): string;
127
-
128
- /**
129
- * @summary 返回 JSON 字符串表示
130
- *
131
- * @returns JSON 格式的程序表示
132
- *
133
- * @desc 返回包含 nodeName、statements 和 end 的 JSON 对象字符串。
134
- */
135
- toJSON(): string;
136
- }