lt-script 1.0.1 → 1.0.5
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/README.md +548 -15
- package/dist/cli/ltc.js +44 -34
- package/dist/cli/utils.d.ts +40 -0
- package/dist/cli/utils.js +40 -0
- package/dist/compiler/codegen/LuaEmitter.js +20 -3
- package/dist/compiler/lexer/Lexer.js +7 -2
- package/dist/compiler/lexer/Token.d.ts +2 -1
- package/dist/compiler/lexer/Token.js +6 -2
- package/dist/compiler/parser/AST.d.ts +18 -0
- package/dist/compiler/parser/AST.js +3 -0
- package/dist/compiler/parser/Parser.d.ts +6 -0
- package/dist/compiler/parser/Parser.js +216 -31
- package/dist/compiler/semantics/SemanticAnalyzer.d.ts +28 -0
- package/dist/compiler/semantics/SemanticAnalyzer.js +682 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -1
- package/package.json +12 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Lexer } from './compiler/lexer/Lexer.js';
|
|
2
2
|
import { Parser } from './compiler/parser/Parser.js';
|
|
3
3
|
import { LuaEmitter } from './compiler/codegen/LuaEmitter.js';
|
|
4
|
+
import { SemanticAnalyzer } from './compiler/semantics/SemanticAnalyzer.js';
|
|
4
5
|
export declare function compile(source: string): string;
|
|
5
|
-
export { Lexer, Parser, LuaEmitter };
|
|
6
|
+
export { Lexer, Parser, LuaEmitter, SemanticAnalyzer };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { Lexer } from './compiler/lexer/Lexer.js';
|
|
2
2
|
import { Parser } from './compiler/parser/Parser.js';
|
|
3
3
|
import { LuaEmitter } from './compiler/codegen/LuaEmitter.js';
|
|
4
|
+
import { SemanticAnalyzer } from './compiler/semantics/SemanticAnalyzer.js';
|
|
4
5
|
export function compile(source) {
|
|
5
6
|
const lexer = new Lexer(source);
|
|
6
7
|
const tokens = lexer.tokenize();
|
|
8
|
+
// DEBUG: Check first token to see if it has line info
|
|
9
|
+
// if (tokens.length > 0) {
|
|
10
|
+
// console.log('[DEBUG] First Token:', JSON.stringify(tokens[0]));
|
|
11
|
+
// console.log('[DEBUG] Token count:', tokens.length);
|
|
12
|
+
// }
|
|
7
13
|
const parser = new Parser(tokens);
|
|
8
14
|
const ast = parser.parse();
|
|
15
|
+
const analyzer = new SemanticAnalyzer();
|
|
16
|
+
analyzer.analyze(ast);
|
|
9
17
|
const emitter = new LuaEmitter();
|
|
10
18
|
return emitter.emit(ast);
|
|
11
19
|
}
|
|
12
|
-
export { Lexer, Parser, LuaEmitter };
|
|
20
|
+
export { Lexer, Parser, LuaEmitter, SemanticAnalyzer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lt-script",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "LT Language Compiler for FiveM",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,16 +18,25 @@
|
|
|
18
18
|
"laot",
|
|
19
19
|
"lt"
|
|
20
20
|
],
|
|
21
|
-
"author": "
|
|
21
|
+
"author": "laot",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/laot7490/lt-script.git"
|
|
25
|
+
},
|
|
22
26
|
"license": "MIT",
|
|
23
27
|
"scripts": {
|
|
24
28
|
"build": "tsc",
|
|
25
29
|
"dev": "tsc --watch",
|
|
26
30
|
"test": "node dist/tests/run.js",
|
|
27
|
-
"
|
|
31
|
+
"build:lt": "npm run build",
|
|
32
|
+
"build:vscode": "cd vscode-extension && npx vsce package",
|
|
33
|
+
"watch:playground": "tsx src/cli/ltc.ts watch playground",
|
|
34
|
+
"watch:testing": "tsx src/cli/ltc.ts watch .testing",
|
|
35
|
+
"github:push": "node tools/push.js"
|
|
28
36
|
},
|
|
29
37
|
"devDependencies": {
|
|
30
38
|
"@types/node": "^25.0.10",
|
|
39
|
+
"tsx": "^4.21.0",
|
|
31
40
|
"typescript": "^5.3.0"
|
|
32
41
|
}
|
|
33
42
|
}
|