@designliquido/birl 0.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/LICENSE +21 -0
- package/README.md +31 -0
- package/analisador-semantico/analisador-semantico-birl.d.ts +29 -0
- package/analisador-semantico/analisador-semantico-birl.d.ts.map +1 -0
- package/analisador-semantico/analisador-semantico-birl.js +88 -0
- package/analisador-semantico/analisador-semantico-birl.js.map +1 -0
- package/analisador-semantico/index.d.ts +2 -0
- package/analisador-semantico/index.d.ts.map +1 -0
- package/analisador-semantico/index.js +18 -0
- package/analisador-semantico/index.js.map +1 -0
- package/avaliador-sintatico/avaliador-sintatico-birl.d.ts +54 -0
- package/avaliador-sintatico/avaliador-sintatico-birl.d.ts.map +1 -0
- package/avaliador-sintatico/avaliador-sintatico-birl.js +674 -0
- package/avaliador-sintatico/avaliador-sintatico-birl.js.map +1 -0
- package/avaliador-sintatico/index.d.ts +2 -0
- package/avaliador-sintatico/index.d.ts.map +1 -0
- package/avaliador-sintatico/index.js +18 -0
- package/avaliador-sintatico/index.js.map +1 -0
- package/interpretador/comum.d.ts +17 -0
- package/interpretador/comum.d.ts.map +1 -0
- package/interpretador/comum.js +271 -0
- package/interpretador/comum.js.map +1 -0
- package/interpretador/index.d.ts +3 -0
- package/interpretador/index.d.ts.map +1 -0
- package/interpretador/index.js +19 -0
- package/interpretador/index.js.map +1 -0
- package/interpretador/interpretador-birl-com-depuracao.d.ts +27 -0
- package/interpretador/interpretador-birl-com-depuracao.d.ts.map +1 -0
- package/interpretador/interpretador-birl-com-depuracao.js +68 -0
- package/interpretador/interpretador-birl-com-depuracao.js.map +1 -0
- package/interpretador/interpretador-birl.d.ts +158 -0
- package/interpretador/interpretador-birl.d.ts.map +1 -0
- package/interpretador/interpretador-birl.js +702 -0
- package/interpretador/interpretador-birl.js.map +1 -0
- package/lexador/index.d.ts +2 -0
- package/lexador/index.d.ts.map +1 -0
- package/lexador/index.js +18 -0
- package/lexador/index.js.map +1 -0
- package/lexador/lexador-birl.d.ts +14 -0
- package/lexador/lexador-birl.d.ts.map +1 -0
- package/lexador/lexador-birl.js +240 -0
- package/lexador/lexador-birl.js.map +1 -0
- package/lexador/palavras-reservadas.d.ts +46 -0
- package/lexador/palavras-reservadas.d.ts.map +1 -0
- package/lexador/palavras-reservadas.js +53 -0
- package/lexador/palavras-reservadas.js.map +1 -0
- package/package.json +40 -0
- package/tipos-de-simbolos/lexico-regular.d.ts +91 -0
- package/tipos-de-simbolos/lexico-regular.d.ts.map +1 -0
- package/tipos-de-simbolos/lexico-regular.js +98 -0
- package/tipos-de-simbolos/lexico-regular.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Design Liquido
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# birl
|
|
2
|
+
|
|
3
|
+
Nossa implementação do dialeto BIRL, usando TypeScript.
|
|
4
|
+
|
|
5
|
+
## Sobre este dialeto
|
|
6
|
+
|
|
7
|
+
Este dialeto tenta implementar da forma mais fidedigna possível todos os comportamentos de execução de BIRL como foi implementado em [https://birl-language.github.io]. Basicamente, o mecanismo dessa linguagem é traduzir todos os comandos para C, fazer o deploy em um servidor na Heroku e executar. O problema é que a Heroku deixou de ser gratuita há algum tempo, e por causa disso a ferramenta nunca mais funcionou. A ideia do dialeto é puramente preservação e didática.
|
|
8
|
+
|
|
9
|
+
Inicialmente, este dialeto foi implementado dentro do núcleo de Delégua, já que tínhamos a ideia de (talvez) aproveitar algumas das funcionalidades implementadas em Delégua. Com a incorporação de mais dialetos ao núcleo, a manutenção do monolito começou a trazer impactos ao núcleo como um todo, com instruções que sequer existem em um dialeto tendo que ser implementadas porque outro dialeto a possui. Portanto, este dialeto foi separado do núcleo de Delégua, mas ainda o utiliza como dependência.
|
|
10
|
+
|
|
11
|
+
## Componentes implementados
|
|
12
|
+
|
|
13
|
+
Este dialeto implementa os seguintes componentes:
|
|
14
|
+
|
|
15
|
+
- **Lexador**: responsável pela análise léxica da linguagem: converte um texto em símbolos (_tokens_) que são utilizados na avaliação sintática;
|
|
16
|
+
- **Avaliador Sintático**: responsável por converter símbolos em estruturas de alto nível. Essas estruturas de alto nível podem ser usadas para execução de código, formatação de código, tradução do fonte em outra linguagem de programação e análise semântica;
|
|
17
|
+
- **Interpretador**: recebe estruturas de alto nível da avaliação sintática e as executa como instruções;
|
|
18
|
+
- **Analisador Semântico**: recebe estruturas de alto nível e verifica se a execução do código correspondente faz sentido ou não. O código de entrada pode estar perfeitamente escrito quanto ao léxico e sintaxe, mas podem haver problemas como variáveis que não existem, funções que retornam um tipo incorreto, execuções impossíveis como divisões por zero, entre outras heurísticas.
|
|
19
|
+
|
|
20
|
+
## Finalidade educacional
|
|
21
|
+
|
|
22
|
+
A finalidade educacional deste dialeto serve a dois grandes propósitos:
|
|
23
|
+
|
|
24
|
+
- Permitir a qualquer pessoa executar código em BIRL, independente de sistema operacional e dispositivo, e independente de plataformas como a Heroku;
|
|
25
|
+
- Possibilitar a alunos que estejam estudando disciplinas de ciência da computação ou tecnologia da informação, como compiladores, a entender como esses componentes funcionando, já que boa parte deles faz parte do currículo eletivo de diversas instituições de ensino pelo mundo. O material disponível para tal é farto na língua inglesa, mas não na língua portuguesa.
|
|
26
|
+
|
|
27
|
+
## Compatibilidade com JavaScript e Node.js
|
|
28
|
+
|
|
29
|
+
Este dialeto é distribuído como um pacote do [NPM](https://npmjs.com), e é compatível com qualquer versão de JavaScript e Node.js. O código é escrito em TypeScript, mas transpilado para JavaScript ES5, virtualmente compatível com 100% dos navegadores de internet disponíveis atualmente.
|
|
30
|
+
|
|
31
|
+
Este dialeto pode ser utilizado como base para construir outras aplicações, como _sites_ de internet, aplicativos para dispositivos móveis e até mesmo scripts executados por linha de comando. É também agregado ao [pacote de Delégua para Node.js](https://github.com/DesignLiquido/delegua-node), o que permite a execução de fontes por linha de comando.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Atribuir } from '@designliquido/delegua/construtos';
|
|
2
|
+
import { Declaracao, Expressao, Leia, Retorna, Var } from '@designliquido/delegua/declaracoes';
|
|
3
|
+
import { DiagnosticoAnalisadorSemantico } from '@designliquido/delegua/interfaces/erros';
|
|
4
|
+
import { RetornoAnalisadorSemantico } from '@designliquido/delegua/interfaces/retornos/retorno-analisador-semantico';
|
|
5
|
+
import { RetornoQuebra } from '@designliquido/delegua/quebras';
|
|
6
|
+
import { AnalisadorSemanticoBase } from '@designliquido/delegua/analisador-semantico/analisador-semantico-base';
|
|
7
|
+
import { PilhaVariaveis } from '@designliquido/delegua/analisador-semantico/pilha-variaveis';
|
|
8
|
+
interface VariavelHipoteticaBirlInterface {
|
|
9
|
+
tipo: 'texto' | 'número' | 'longo' | 'vetor' | 'dicionário' | 'nulo' | 'lógico' | 'função' | 'símbolo' | 'objeto' | 'módulo';
|
|
10
|
+
subtipo?: 'texto' | 'número' | 'longo' | 'lógico';
|
|
11
|
+
imutavel: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class AnalisadorSemanticoBirl extends AnalisadorSemanticoBase {
|
|
14
|
+
pilhaVariaveis: PilhaVariaveis;
|
|
15
|
+
variaveis: {
|
|
16
|
+
[nomeVariavel: string]: VariavelHipoteticaBirlInterface;
|
|
17
|
+
};
|
|
18
|
+
atual: number;
|
|
19
|
+
diagnosticos: DiagnosticoAnalisadorSemantico[];
|
|
20
|
+
constructor();
|
|
21
|
+
visitarExpressaoDeAtribuicao(expressao: Atribuir): Promise<void>;
|
|
22
|
+
visitarDeclaracaoDeExpressao(declaracao: Expressao): any;
|
|
23
|
+
visitarDeclaracaoVar(declaracao: Var): Promise<any>;
|
|
24
|
+
visitarExpressaoLeia(expressao: Leia): Promise<void>;
|
|
25
|
+
visitarExpressaoRetornar(declaracao: Retorna): Promise<RetornoQuebra>;
|
|
26
|
+
analisar(declaracoes: Declaracao[]): RetornoAnalisadorSemantico;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=analisador-semantico-birl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analisador-semantico-birl.d.ts","sourceRoot":"","sources":["../../fontes/analisador-semantico/analisador-semantico-birl.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAEX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,UAAU,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,GAAG,EACN,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAyB,MAAM,yCAAyC,CAAC;AAChH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yEAAyE,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uEAAuE,CAAC;AAChH,OAAO,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAE7F,UAAU,+BAA+B;IACrC,IAAI,EACE,OAAO,GACP,QAAQ,GACR,OAAO,GACP,OAAO,GACP,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,uBAAwB,SAAQ,uBAAuB;IAChE,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,+BAA+B,CAAA;KAAE,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,8BAA8B,EAAE,CAAC;;IAU/C,4BAA4B,CAAC,SAAS,EAAE,QAAQ;IAwBhD,4BAA4B,CAAC,UAAU,EAAE,SAAS;IAIlD,oBAAoB,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IASnD,oBAAoB,CAAC,SAAS,EAAE,IAAI;IA8BpC,wBAAwB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrE,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,0BAA0B;CAclE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalisadorSemanticoBirl = void 0;
|
|
4
|
+
const erros_1 = require("@designliquido/delegua/interfaces/erros");
|
|
5
|
+
const analisador_semantico_base_1 = require("@designliquido/delegua/analisador-semantico/analisador-semantico-base");
|
|
6
|
+
const pilha_variaveis_1 = require("@designliquido/delegua/analisador-semantico/pilha-variaveis");
|
|
7
|
+
class AnalisadorSemanticoBirl extends analisador_semantico_base_1.AnalisadorSemanticoBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.pilhaVariaveis = new pilha_variaveis_1.PilhaVariaveis();
|
|
11
|
+
this.variaveis = {};
|
|
12
|
+
this.atual = 0;
|
|
13
|
+
this.diagnosticos = [];
|
|
14
|
+
}
|
|
15
|
+
visitarExpressaoDeAtribuicao(expressao) {
|
|
16
|
+
if (!this.variaveis.hasOwnProperty(expressao.simbolo.lexema)) {
|
|
17
|
+
this.diagnosticos.push({
|
|
18
|
+
simbolo: expressao.simbolo,
|
|
19
|
+
mensagem: `A variável ${expressao.simbolo.lexema} não foi declarada.`,
|
|
20
|
+
hashArquivo: expressao.hashArquivo,
|
|
21
|
+
linha: expressao.linha,
|
|
22
|
+
severidade: erros_1.DiagnosticoSeveridade.ERRO,
|
|
23
|
+
});
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
if (this.variaveis[expressao.simbolo.lexema].imutavel) {
|
|
27
|
+
this.diagnosticos.push({
|
|
28
|
+
simbolo: expressao.simbolo,
|
|
29
|
+
mensagem: `Constante ${expressao.simbolo.lexema} não pode ser modificada.`,
|
|
30
|
+
hashArquivo: expressao.hashArquivo,
|
|
31
|
+
linha: expressao.linha,
|
|
32
|
+
severidade: erros_1.DiagnosticoSeveridade.ERRO,
|
|
33
|
+
});
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
visitarDeclaracaoDeExpressao(declaracao) {
|
|
38
|
+
return declaracao.expressao.aceitar(this);
|
|
39
|
+
}
|
|
40
|
+
visitarDeclaracaoVar(declaracao) {
|
|
41
|
+
this.variaveis[declaracao.simbolo.lexema] = {
|
|
42
|
+
imutavel: false,
|
|
43
|
+
tipo: 'número',
|
|
44
|
+
};
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
visitarExpressaoLeia(expressao) {
|
|
48
|
+
if (!this.variaveis.hasOwnProperty(expressao.argumentos[0].simbolo.lexema)) {
|
|
49
|
+
this.diagnosticos.push({
|
|
50
|
+
simbolo: expressao.argumentos[0].simbolo,
|
|
51
|
+
mensagem: `A variável ${expressao.argumentos[0].simbolo.lexema} não foi declarada.`,
|
|
52
|
+
hashArquivo: expressao.hashArquivo,
|
|
53
|
+
linha: expressao.linha,
|
|
54
|
+
severidade: erros_1.DiagnosticoSeveridade.ERRO,
|
|
55
|
+
});
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
}
|
|
58
|
+
const tipoVariavelExpressão = this.variaveis[expressao.argumentos[0].simbolo.lexema].tipo;
|
|
59
|
+
const tipoVariavelArgumento = expressao.argumentos[1].valor;
|
|
60
|
+
if (tipoVariavelExpressão !== tipoVariavelArgumento) {
|
|
61
|
+
this.diagnosticos.push({
|
|
62
|
+
simbolo: expressao.argumentos[0].simbolo,
|
|
63
|
+
mensagem: `A variável ${expressao.argumentos[0].simbolo.lexema} não é do tipo ${tipoVariavelArgumento}.`,
|
|
64
|
+
hashArquivo: expressao.hashArquivo,
|
|
65
|
+
linha: expressao.linha,
|
|
66
|
+
severidade: erros_1.DiagnosticoSeveridade.ERRO,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return Promise.resolve();
|
|
70
|
+
}
|
|
71
|
+
visitarExpressaoRetornar(declaracao) {
|
|
72
|
+
return Promise.resolve(null);
|
|
73
|
+
}
|
|
74
|
+
analisar(declaracoes) {
|
|
75
|
+
this.variaveis = {};
|
|
76
|
+
this.atual = 0;
|
|
77
|
+
this.diagnosticos = [];
|
|
78
|
+
while (this.atual < declaracoes.length) {
|
|
79
|
+
declaracoes[this.atual].aceitar(this);
|
|
80
|
+
this.atual++;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
diagnosticos: this.diagnosticos,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.AnalisadorSemanticoBirl = AnalisadorSemanticoBirl;
|
|
88
|
+
//# sourceMappingURL=analisador-semantico-birl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analisador-semantico-birl.js","sourceRoot":"","sources":["../../fontes/analisador-semantico/analisador-semantico-birl.ts"],"names":[],"mappings":";;;AAWA,mEAAgH;AAGhH,qHAAgH;AAChH,iGAA6F;AAmB7F,MAAa,uBAAwB,SAAQ,mDAAuB;IAMhE;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,4BAA4B,CAAC,SAAmB;QAC5C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,SAAS,CAAC,OAAO;gBAC1B,QAAQ,EAAE,cAAc,SAAS,CAAC,OAAO,CAAC,MAAM,qBAAqB;gBACrE,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,UAAU,EAAE,6BAAqB,CAAC,IAAI;aACzC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,SAAS,CAAC,OAAO;gBAC1B,QAAQ,EAAE,aAAa,SA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,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./analisador-semantico-birl"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../fontes/analisador-semantico/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Chamada, FuncaoConstruto } from '@designliquido/delegua/construtos';
|
|
2
|
+
import { Bloco, Continua, Declaracao, Enquanto, Escolha, Escreva, Expressao, Fazer, FuncaoDeclaracao, Leia, Para, Retorna, Se, Sustar, Var } from '@designliquido/delegua/declaracoes';
|
|
3
|
+
import { RetornoAvaliadorSintatico, RetornoLexador } from '@designliquido/delegua/interfaces/retornos';
|
|
4
|
+
import { AvaliadorSintaticoBase } from '@designliquido/delegua/avaliador-sintatico/avaliador-sintatico-base';
|
|
5
|
+
import { Construto } from '@designliquido/delegua/construtos/construto';
|
|
6
|
+
import { ParametroInterface, SimboloInterface } from '@designliquido/delegua/interfaces';
|
|
7
|
+
/**
|
|
8
|
+
* Avaliador Sintático de BIRL
|
|
9
|
+
*/
|
|
10
|
+
export declare class AvaliadorSintaticoBirl extends AvaliadorSintaticoBase {
|
|
11
|
+
private validarEscopoPrograma;
|
|
12
|
+
tratarSimbolos(simbolos: Array<SimboloInterface>): string | void;
|
|
13
|
+
validarSegmentoHoraDoShow(): void;
|
|
14
|
+
validarSegmentoBirlFinal(): void;
|
|
15
|
+
primario(): Construto;
|
|
16
|
+
chamar(): Construto;
|
|
17
|
+
atribuir(): Construto;
|
|
18
|
+
blocoEscopo(): Declaracao[];
|
|
19
|
+
declaracaoEnquanto(): Enquanto;
|
|
20
|
+
declaracaoExpressao(): Expressao;
|
|
21
|
+
declaracaoPara(): Para;
|
|
22
|
+
declaracaoEscolha(): Escolha;
|
|
23
|
+
declaracaoEscreva(): Escreva;
|
|
24
|
+
declaracaoFazer(): Fazer;
|
|
25
|
+
declaracaoCaracteres(): Var[];
|
|
26
|
+
validarTipoDeclaracaoInteiro(): SimboloInterface;
|
|
27
|
+
declaracaoInteiros(): Var[];
|
|
28
|
+
declaracaoPontoFlutuante(): Var[];
|
|
29
|
+
declaracaoRetorna(): Retorna;
|
|
30
|
+
protected validaTipoDeclaracaoLeia(caracteres: string): string;
|
|
31
|
+
declaracaoLeia(): Leia;
|
|
32
|
+
protected consomeSeSenao(): {
|
|
33
|
+
condicaoSeSenao: any;
|
|
34
|
+
};
|
|
35
|
+
protected consomeSe(): {
|
|
36
|
+
simboloSe: SimboloInterface<string>;
|
|
37
|
+
condicaoSe: any;
|
|
38
|
+
};
|
|
39
|
+
consumeSenao(): void;
|
|
40
|
+
resolveCaminhoSe(): Bloco;
|
|
41
|
+
declaracaoSe(): Se;
|
|
42
|
+
resolveSimboloInterfaceParaTiposDadosInterface(simbolo: SimboloInterface): "numero" | "texto";
|
|
43
|
+
protected logicaComumParamentros(): ParametroInterface[];
|
|
44
|
+
corpoDaFuncao(tipo: string): FuncaoConstruto;
|
|
45
|
+
declacacaoEnquanto(): Enquanto;
|
|
46
|
+
declaracaoSustar(): Sustar;
|
|
47
|
+
declaracaoContinua(): Continua;
|
|
48
|
+
resolveTipo(tipo: string): SimboloInterface;
|
|
49
|
+
funcao(tipo: string): FuncaoDeclaracao;
|
|
50
|
+
declaracaoChamaFuncao(): Chamada;
|
|
51
|
+
resolverDeclaracaoForaDeBloco(): any;
|
|
52
|
+
analisar(retornoLexador: RetornoLexador<SimboloInterface>, hashArquivo: number): RetornoAvaliadorSintatico<Declaracao>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=avaliador-sintatico-birl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avaliador-sintatico-birl.d.ts","sourceRoot":"","sources":["../../fontes/avaliador-sintatico/avaliador-sintatico-birl.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,OAAO,EAEP,eAAe,EAIlB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,EAAE,EACF,MAAM,EACN,GAAG,EACN,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qEAAqE,CAAC;AAE7G,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGzF;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,sBAAsB;IAC9D,OAAO,CAAC,qBAAqB;IAiB7B,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,MAAM,GAAG,IAAI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