Skip to content

Commit

Permalink
Construto de comentário (#678)
Browse files Browse the repository at this point in the history
* Construto de comentário e impactos iniciais.
* Implementações do construto de comentário no Lexador e no Avaliador Sintático.
  • Loading branch information
leonelsanchesdasilva authored Apr 29, 2024
1 parent 47f4d01 commit 71492b1
Show file tree
Hide file tree
Showing 20 changed files with 470 additions and 288 deletions.
23 changes: 14 additions & 9 deletions fontes/analisador-semantico/analisador-semantico-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
TipoDe,
Unario,
Vetor,
Comentario,
} from '../construtos';
import {
Declaracao,
Expand Down Expand Up @@ -54,7 +55,6 @@ import {
Retorna,
Sustar,
} from '../declaracoes';
import { DeleguaFuncao } from '../estruturas';
import { AnalisadorSemanticoInterface } from '../interfaces/analisador-semantico-interface';
import { RetornoAnalisadorSemantico } from '../interfaces/retornos/retorno-analisador-semantico';
import { ContinuarQuebra, RetornoQuebra, SustarQuebra } from '../quebras';
Expand All @@ -65,16 +65,9 @@ import { ContinuarQuebra, RetornoQuebra, SustarQuebra } from '../quebras';
* simplesmente passa por ele (`return Promise.resolve()`).
*/
export abstract class AnalisadorSemanticoBase implements AnalisadorSemanticoInterface {

abstract analisar(declaracoes: Declaracao[]): RetornoAnalisadorSemantico;

visitarDeclaracaoTendoComo(declaracao: TendoComo): Promise<any> {
return Promise.resolve();
}

visitarDeclaracaoInicioAlgoritmo(declaracao: InicioAlgoritmo): Promise<any> {
return Promise.resolve();
}

visitarDeclaracaoAleatorio(declaracao: Aleatorio): Promise<any> {
return Promise.resolve();
}
Expand All @@ -87,6 +80,10 @@ export abstract class AnalisadorSemanticoBase implements AnalisadorSemanticoInte
return Promise.resolve();
}

visitarDeclaracaoComentario(declaracao: Comentario): void | Promise<any> {
return Promise.resolve();
}

visitarDeclaracaoConst(declaracao: Const): Promise<any> {
return Promise.resolve();
}
Expand Down Expand Up @@ -127,6 +124,10 @@ export abstract class AnalisadorSemanticoBase implements AnalisadorSemanticoInte
return Promise.resolve();
}

visitarDeclaracaoInicioAlgoritmo(declaracao: InicioAlgoritmo): Promise<any> {
return Promise.resolve();
}

visitarDeclaracaoPara(declaracao: Para): Promise<any> {
return Promise.resolve();
}
Expand All @@ -139,6 +140,10 @@ export abstract class AnalisadorSemanticoBase implements AnalisadorSemanticoInte
return Promise.resolve();
}

visitarDeclaracaoTendoComo(declaracao: TendoComo): Promise<any> {
return Promise.resolve();
}

visitarDeclaracaoTente(declaracao: Tente): Promise<any> {
return Promise.resolve();
}
Expand Down
25 changes: 1 addition & 24 deletions fontes/analisador-semantico/analisador-semantico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,31 @@ import {
Binario,
Chamada,
Construto,
ExpressaoRegular,
FimPara,
FormatacaoEscrita,
FuncaoConstruto,
Literal,
Logico,
Super,
TipoDe,
Tupla,
Variavel,
Vetor,
} from '../construtos';
import {
Aleatorio,
Bloco,
CabecalhoPrograma,
Classe,
Const,
ConstMultiplo,
Continua,
Declaracao,
Enquanto,
Escolha,
Escreva,
EscrevaMesmaLinha,
Expressao,
Falhar,
Fazer,
FuncaoDeclaracao,
Importar,
Leia,
LeiaMultiplo,
Para,
ParaCada,
Retorna,
Se,
Sustar,
Tente,
Var,
VarMultiplo,
} from '../declaracoes';
import { InicioAlgoritmo } from '../declaracoes/inicio-algoritmo';
import { SimboloInterface } from '../interfaces';
import { AnalisadorSemanticoInterface } from '../interfaces/analisador-semantico-interface';
import { DiagnosticoAnalisadorSemantico, DiagnosticoSeveridade } from '../interfaces/erros';
import { RetornoAnalisadorSemantico } from '../interfaces/retornos/retorno-analisador-semantico';
import { TipoDadosElementar } from '../tipo-dados-elementar';
import { ContinuarQuebra, RetornoQuebra, SustarQuebra } from '../quebras';
import { RetornoQuebra } from '../quebras';
import { AnalisadorSemanticoBase } from './analisador-semantico-base';
import { PilhaVariaveis } from './pilha-variaveis';

Expand Down
Loading

0 comments on commit 71492b1

Please sign in to comment.