feat: implement module system with imports and exports support

This commit is contained in:
2025-11-15 19:03:36 +07:00
parent 3a0f152c6e
commit 69ea8329e9
14 changed files with 623 additions and 30 deletions

View File

@@ -21,17 +21,17 @@ export class QuestLang {
/**
* Create interpreter from source code
*/
public static interpret(source: string): QuestInterpreter {
public static interpret(source: string, filePath?: string): QuestInterpreter {
const ast = this.parse(source);
return new QuestInterpreter(ast);
return new QuestInterpreter(ast, filePath);
}
/**
* Validate QuestLang source code
*/
public static validate(source: string): { isValid: boolean; errors: string[] } {
public static validate(source: string, filePath?: string): { isValid: boolean; errors: string[] } {
try {
const interpreter = this.interpret(source);
const interpreter = this.interpret(source, filePath);
return interpreter.validate();
}
catch (error) {