COMPORT – Compilador Portugol - Nilo Menezes
COMPORT – Compilador Portugol - Nilo Menezes
COMPORT – Compilador Portugol - Nilo Menezes
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
PRINCIPAL.CPP<br />
#include <br />
#include <br />
#include <br />
// extern void mainScanner(void);<br />
// extern void mainCodeGenerator(void);<br />
#include "scanner.h"<br />
#include "codegenerator.h"<br />
#include "risc.h"<br />
#include "parser.h"<br />
#define VERSAO "0.92"<br />
#define DATA "2003-09-06"<br />
TRisc RISC;<br />
int<br />
main (int argc, char **argv)<br />
{<br />
FILE *FONTE;<br />
spawnl(P_WAIT, "pagina.bat", "pagina.bat","1252",NULL);<br />
}<br />
mainScanner ();<br />
mainCodeGenerator ();<br />
mainParser ();<br />
ComPort <strong>–</strong> <strong>Compilador</strong> <strong>Portugol</strong><br />
if(argc==2)<br />
{<br />
FONTE = fopen(argv[1],"r");<br />
if(FONTE==NULL)<br />
{<br />
fprintf(stderr, "Erro ao abrir arquivo fonte!! [%s]\n", argv[1]);<br />
exit(1);<br />
}<br />
}<br />
else<br />
{<br />
FONTE=stdin;<br />
fprintf(stderr, "Lendo fonte da entrada padrão [stdin]\n");<br />
}<br />
Compile (FONTE);<br />
// Pausa para manter a janela aberta (tecla para terminar)<br />
fgetc(stdin);<br />
109