?? compilador.cpp
字號(hào):
/********************************************************************
* MINI-COMPILADOR PARA O MINI-PASCAL *
* ----------------------------------------------------------------- *
* Membros: Anderson de Rezende Rocha - DCC/UFLA *
* undersun@comp.ufla.br *
* *
* J鷏io C閟ar Alves - DCC/UFLA *
* jcalves@comp.ufla.br *
* ----------------------------------------------------------------- *
* COMPILADORES: Prof. M醨io Luis R. Oliveira *
********************************************************************/
// TODOS os FLAGs utilizados pelo nosso analisador.
enum FLAGS { NENHUMA = 97, PALAVRA, CONSTANTE, CADEIA,
MAIS, MENOS, VEZES, DIV, OPNEG, IGUAL, MENORIGUAL, DIFERENTE, MENOR, MAIORIGUAL,
MAIOR, PVIRG, PONTO, VIRG, ABREPAR, FECHAPAR, ENDOFFILE, INVALIDO, COMENTARIO, ATRIB,
DPONTOS, CHAR, ID, OPAD, OPREL, OPLOG, OPMULT, PROGRAMA, COMECO, LOGICO,
FACA, ENTAO, FALSO, SE, INTEIRO, REAL, VERDADEIRO, ENQUANTO, VARIAVEIS, SENAO,
STRING, ESCREVA, LEIA, FIM, CORINGA, AVANCA, };
#include <iostream>
#include "lista.h"
#include "logErros.h"
#include "token.h"
#include "analisadorLexico.h"
#include "analisadorSintatico.h"
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
// Direitos autorais
cout << "\n------------------------------------------------------------"
<< "\n\t\tANALISADOR SOBRABURU vs 1.1"
<< "\nCopyright by Anderson de Rezende Rocha e Julio Cesar Alves\n"
<< "------------------------------------------------------------\n" << endl;
// Nenhum arquivo foi passado para ser analisado
if (argc == 1)
cout << "\n\nNao e possivel proceder. Para compilar use a seguinte sintaxe:\n"
<< "\t<compilador> <nome_do_arquivo.pas> [ENTER]\n" << endl;
else
{
// Um arquivo foi passado para an醠ise
char *nomeArquivo = argv[1];
ifstream arq(nomeArquivo);
// O arquivo n鉶 foi encontrado no diret髍io atual
if (!arq)
cout << "\nO arquivo '" << nomeArquivo << "' nao foi encontrado\n" << endl;
else
{
// Iniciando a an醠ise l閤ica
cout << "Analisando '" << nomeArquivo << "'\n" << endl;
clLista<clToken> tabelaDeSimbolos;
clLogErros logErros;
clAnalisadorLexico lexico(tabelaDeSimbolos, logErros);
clAnalisadorSintatico sintatico(tabelaDeSimbolos, logErros);
lexico.Analisar((string)(nomeArquivo));
// Caso n鉶 haja erros na an醠ise L閤ica a an醠ise sint醫(yī)ica
//
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -