@designliquido/delegua 0.0.2 → 0.1.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/.github/CONTRIBUTING.md +37 -0
- package/.github/workflows/principal.yml +3 -1
- package/.release-it.json +2 -1
- package/.vscode/launch.json +43 -8
- package/README.md +9 -1
- package/bin/delegua +2 -2
- package/bin/delegua.cmd +1 -1
- package/index.ts +29 -0
- package/package.json +9 -4
- package/src/ambiente.ts +56 -0
- package/src/avaliador-sintatico/dialetos/egua-classico.ts +983 -0
- package/src/avaliador-sintatico/dialetos/index.ts +1 -0
- package/src/avaliador-sintatico/index.ts +983 -0
- package/src/avaliador-sintatico/parser-error.ts +1 -0
- package/src/{lib/globalLib.js → bibliotecas/bibliotecaGlobal.ts} +34 -34
- package/src/{lib/importStdlib.js → bibliotecas/importarBiblioteca.ts} +9 -9
- package/src/construtos/assign-subscript.ts +19 -0
- package/src/construtos/atribuir.ts +17 -0
- package/src/construtos/binario.ts +19 -0
- package/src/construtos/call.ts +19 -0
- package/src/construtos/conjunto.ts +19 -0
- package/src/construtos/dicionario.ts +17 -0
- package/src/construtos/expr.ts +3 -0
- package/src/construtos/funcao.ts +17 -0
- package/src/construtos/get.ts +17 -0
- package/src/construtos/grouping.ts +15 -0
- package/src/construtos/index.ts +18 -0
- package/src/construtos/isto.ts +15 -0
- package/src/construtos/literal.ts +15 -0
- package/src/construtos/logical.ts +19 -0
- package/src/construtos/subscript.ts +19 -0
- package/src/construtos/super.ts +17 -0
- package/src/construtos/unario.ts +17 -0
- package/src/construtos/variavel.ts +15 -0
- package/src/construtos/vetor.ts +15 -0
- package/src/{stmt.js → declaracoes/index.ts} +79 -51
- package/src/delegua.ts +156 -0
- package/src/estruturas/callable.ts +11 -0
- package/src/estruturas/{classe.js → classe.ts} +11 -7
- package/src/estruturas/{funcaoPadrao.js → funcao-padrao.ts} +8 -4
- package/src/estruturas/funcao.ts +70 -0
- package/src/estruturas/index.ts +6 -0
- package/src/estruturas/{instancia.js → instancia.ts} +12 -9
- package/src/estruturas/modulo.ts +11 -0
- package/src/excecoes/break-exception.ts +1 -0
- package/src/excecoes/continue-exception.ts +1 -0
- package/src/excecoes/erro-em-tempo-de-execucao.ts +11 -0
- package/src/excecoes/index.ts +4 -0
- package/src/excecoes/return-exception.ts +10 -0
- package/src/interfaces/avaliador-sintatico-interface.ts +58 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/interpretador-interface.ts +52 -0
- package/src/interfaces/lexador-interface.ts +24 -0
- package/src/interfaces/pilha-interface.ts +7 -0
- package/src/interfaces/resolvedor-interface.ts +49 -0
- package/src/interfaces/simbolo-interface.ts +6 -0
- package/src/interpretador/dialetos/egua-classico.ts +825 -0
- package/src/interpretador/dialetos/index.ts +1 -0
- package/src/interpretador/index.ts +825 -0
- package/src/lexador/dialetos/egua-classico.ts +333 -0
- package/src/lexador/dialetos/index.ts +1 -0
- package/src/{lexer.js → lexador/index.ts} +38 -21
- package/src/resolvedor/Pilha.ts +29 -0
- package/src/resolvedor/ResolverError.ts +8 -0
- package/src/resolvedor/dialetos/egua-classico.ts +412 -0
- package/src/resolvedor/dialetos/index.ts +1 -0
- package/src/{resolver.js → resolvedor/index.ts} +101 -114
- package/src/{tiposDeSimbolos.js → tiposDeSimbolos.ts} +21 -22
- package/src/web.ts +75 -0
- package/tsconfig.json +11 -0
- package/indice.js +0 -14
- package/src/ambiente.js +0 -53
- package/src/delegua.js +0 -102
- package/src/erro.js +0 -18
- package/src/estruturas/callable.js +0 -5
- package/src/estruturas/funcao.js +0 -62
- package/src/estruturas/modulo.js +0 -9
- package/src/expr.js +0 -228
- package/src/interpretador.js +0 -802
- package/src/parser.js +0 -822
- package/src/web.js +0 -70
package/src/web.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const Lexer = require("./lexer.js");
|
|
2
|
-
const Parser = require("./parser.js");
|
|
3
|
-
const Resolver = require("./resolver.js");
|
|
4
|
-
const Interpretador = require("./interpretador.js");
|
|
5
|
-
const tokenTypes = require("./tokenTypes.js");
|
|
6
|
-
|
|
7
|
-
module.exports.Delegua = class Delegua {
|
|
8
|
-
constructor(nomeArquivo) {
|
|
9
|
-
this.nomeArquivo = nomeArquivo;
|
|
10
|
-
|
|
11
|
-
this.teveErro = false;
|
|
12
|
-
this.teveErroEmTempoDeExecucao = false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
runBlock(codigo) {
|
|
16
|
-
const interpretador = new Interpretador(this, process.cwd());
|
|
17
|
-
|
|
18
|
-
const lexer = new Lexer(codigo, this);
|
|
19
|
-
const simbolos = lexer.scan();
|
|
20
|
-
|
|
21
|
-
if (this.teveErro === true) return;
|
|
22
|
-
|
|
23
|
-
const analisar = new Parser(simbolos, this);
|
|
24
|
-
const declaracoes = analisar.analisar();
|
|
25
|
-
|
|
26
|
-
if (this.teveErro === true) return;
|
|
27
|
-
|
|
28
|
-
const resolver = new Resolver(interpretador, this);
|
|
29
|
-
resolver.resolve(declaracoes);
|
|
30
|
-
|
|
31
|
-
if (this.teveErro === true) return;
|
|
32
|
-
|
|
33
|
-
interpretador.interpretar(declaracoes);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
reportar(linha, onde, mensagem) {
|
|
37
|
-
if (this.nomeArquivo)
|
|
38
|
-
console.error(
|
|
39
|
-
`[Arquivo: ${this.nomeArquivo}] [Linha: ${linha}] Erro${onde}: ${mensagem}`
|
|
40
|
-
);
|
|
41
|
-
else console.error(`[Linha: ${linha}] Erro${onde}: ${mensagem}`);
|
|
42
|
-
this.teveErro = true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
erro(simbolo, mensagemDeErro) {
|
|
46
|
-
if (simbolo.tipo === tokenTypes.EOF) {
|
|
47
|
-
this.reportar(simbolo.line, " no final", mensagemDeErro);
|
|
48
|
-
} else {
|
|
49
|
-
this.reportar(simbolo.line, ` no '${simbolo.lexeme}'`, mensagemDeErro);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
lexerError(linha, caractere, mensagem) {
|
|
54
|
-
this.reportar(linha, ` no '${caractere}'`, mensagem);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
erroEmTempoDeExecucao(erro) {
|
|
58
|
-
const linha = erro.simbolo.linha;
|
|
59
|
-
if (erro.simbolo && linha) {
|
|
60
|
-
if (this.nomeArquivo)
|
|
61
|
-
console.error(
|
|
62
|
-
`Erro: [Arquivo: ${this.nomeArquivo}] [Linha: ${erro.simbolo.linha}] ${erro.mensagem}`
|
|
63
|
-
);
|
|
64
|
-
else console.error(`Erro: [Linha: ${erro.simbolo.linha}] ${erro.mensagem}`);
|
|
65
|
-
} else {
|
|
66
|
-
console.error(`Erro: ${erro.mensagem}`);
|
|
67
|
-
}
|
|
68
|
-
this.teveErroEmTempoDeExecucao = true;
|
|
69
|
-
}
|
|
70
|
-
};
|