@andrivet/z80-assembler 1.0.0
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.
- package/index.d.ts +14 -0
- package/index.js +9 -0
- package/index.mjs +6604 -0
- package/lib/compiler/Ast.d.ts +201 -0
- package/lib/compiler/Compiler.d.ts +53 -0
- package/lib/compiler/Formatter.d.ts +14 -0
- package/lib/compiler/Generator.d.ts +41 -0
- package/lib/compiler/Labels.d.ts +46 -0
- package/lib/grammar/LowLevel.d.ts +68 -0
- package/lib/grammar/Parse.d.ts +38 -0
- package/lib/grammar/z80.d.ts +3370 -0
- package/lib/types/Error.d.ts +63 -0
- package/lib/types/Types.d.ts +40 -0
- package/package.json +12 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z80 Assembler in Typescript
|
|
3
|
+
*
|
|
4
|
+
* File: Error.ts
|
|
5
|
+
* Description: Compilation errors
|
|
6
|
+
* Author: Sebastien Andrivet
|
|
7
|
+
* License: GPLv3
|
|
8
|
+
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
+
*/
|
|
10
|
+
import { PosInfo, SyntaxErr } from "../grammar/z80";
|
|
11
|
+
/**
|
|
12
|
+
* A compilation error.
|
|
13
|
+
*/
|
|
14
|
+
declare class CompilationError extends Error {
|
|
15
|
+
readonly filename: string;
|
|
16
|
+
readonly pos: PosInfo;
|
|
17
|
+
/**
|
|
18
|
+
* Constructor.
|
|
19
|
+
* @param filename Filename where the error occurred.
|
|
20
|
+
* @param pos Position (line, offset) here the error occurred.
|
|
21
|
+
* @param message Description of the error.
|
|
22
|
+
*/
|
|
23
|
+
constructor(filename: string, pos: PosInfo, message: string);
|
|
24
|
+
/**
|
|
25
|
+
* Format the error.
|
|
26
|
+
*/
|
|
27
|
+
toString(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Format internal MatchAttempt
|
|
30
|
+
* @param match The MatchAttempt to format.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private static formatMatch;
|
|
34
|
+
/**
|
|
35
|
+
* Format a syntax error.
|
|
36
|
+
* @param err a syntax error.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private static formatError;
|
|
40
|
+
/**
|
|
41
|
+
* Create a compilation error from a syntax error.
|
|
42
|
+
* @param filename Filename where the error occurred.
|
|
43
|
+
* @param e Syntax error.
|
|
44
|
+
*/
|
|
45
|
+
static fromSyntaxErr(filename: string, e: SyntaxErr): CompilationError;
|
|
46
|
+
/**
|
|
47
|
+
* Create a compilation error from different errors.
|
|
48
|
+
* @param filename Filename where the error occurred.
|
|
49
|
+
* @param e The error
|
|
50
|
+
*/
|
|
51
|
+
static fromAny(filename: string, e: any): CompilationError;
|
|
52
|
+
/**
|
|
53
|
+
* Check if an error is a compilation error (and cast the result in this case)
|
|
54
|
+
* @param err
|
|
55
|
+
*/
|
|
56
|
+
static is(err: any): err is CompilationError;
|
|
57
|
+
/**
|
|
58
|
+
* Check if an error is an array of compilation errors (and cast the result in this case)
|
|
59
|
+
* @param err
|
|
60
|
+
*/
|
|
61
|
+
static isArray(err: any): err is CompilationError[];
|
|
62
|
+
}
|
|
63
|
+
export { CompilationError };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z80 Assembler in Typescript
|
|
3
|
+
*
|
|
4
|
+
* File: Types.ts
|
|
5
|
+
* Description: Common types
|
|
6
|
+
* Author: Sebastien Andrivet
|
|
7
|
+
* License: GPLv3
|
|
8
|
+
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
+
*/
|
|
10
|
+
import { Line } from "../grammar/z80";
|
|
11
|
+
import { CompilationError } from "./Error";
|
|
12
|
+
/**
|
|
13
|
+
* A byte is represented by a number.
|
|
14
|
+
*/
|
|
15
|
+
type byte = number;
|
|
16
|
+
/**
|
|
17
|
+
* An array of bytes.
|
|
18
|
+
*/
|
|
19
|
+
type bytes = byte[];
|
|
20
|
+
/**
|
|
21
|
+
* An address is either a number (known) or null (unknown)
|
|
22
|
+
*/
|
|
23
|
+
type Address = number | null;
|
|
24
|
+
/**
|
|
25
|
+
* Information about lines.
|
|
26
|
+
*/
|
|
27
|
+
interface LinesInfo {
|
|
28
|
+
lines: Line[];
|
|
29
|
+
filename: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The result of a compilation.
|
|
33
|
+
*/
|
|
34
|
+
interface CompilationInfo {
|
|
35
|
+
outputName: string;
|
|
36
|
+
bytes: bytes;
|
|
37
|
+
sld: string;
|
|
38
|
+
errs: CompilationError[];
|
|
39
|
+
}
|
|
40
|
+
export { byte, bytes, Address, LinesInfo, CompilationInfo };
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@andrivet/z80-assembler",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "Sebastien Andrivet",
|
|
5
|
+
"license": "GPLv3",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"keywords": ["z80", "assembler", "ZX81"],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/andrivet/z80-assembler"
|
|
11
|
+
}
|
|
12
|
+
}
|