Montador assembly em javacc

1103 palavras 5 páginas
/** * JavaCC file */ options { JDK_VERSION = "1.5"; IGNORE_CASE = true; FORCE_LA_CHECK= true; LOOKAHEAD = 4;
}
PARSER_BEGIN(eg1) package Montador; import java.io.FileInputStream; import java.io.IOException;

public class eg1 { public static void main(String args[]) throws ParseException{ int contador; try { eg1 parser = new eg1(new java.io.FileInputStream (args[0]));
} catch (IOException e) { System.out.println("Falha ao abrir arquivo."); System.exit(0); } contador = 1; try { while (eg1.Linha() == 0) { //System.out.println("OK." + contador); contador++; } } catch (Exception e) { System.out.println("Erro de Sintaxe na linha " + contador + ".");
//System.out.println(e.getMessage());

} catch (Error e) { System.out.println("Erro de Sintaxe na linha " + contador + "."); //System.out.println(e.getMessage()); } System.out.println("OK. Código sem erro sintático"); } }
PARSER_END(eg1)

SKIP : { " " }
SKIP : { ".segment" | ".bss" | ".text" }

TOKEN :
{
< EOL : "\n" | "\r" | "\t" | "\r\n" >
}

TOKEN:
{
< String:"\'"(~["\n","\r"])*"\'" >
}

TOKEN: { < Coment : ";"(~["\n","\r"])*> }

TOKEN : { < Registrador : "AX" | "CX" | "DX" | "BX" | "SP" | "BP" | "SI" | "DI" | "AL" | "CL" | "DL" | "BL" | "AH" | "CH" | "DH" | "BH" >
}

TOKEN: /* Funções */
{
< INT: "int" > | < MOV : "mov" > | < ORG: "org" > | < times: "times" > | < POPA: "popa" > | < PUSHA: "pusha"> | < POPF : "popf" > | < PUSHF: "pushf" > | < POP: "pop" > | < PUSH: "push" > | < CALL: "call" > | < RET: "ret" > | < ADD: "add" > | < SUB: "sub" > | < MUL: "mul" ("AL"|"AX")","("AL"|"AX")> | < IMUL: "imul"> | < DIV: "div"> | < IDIV: "idiv"> | < CMP: "cmp"> | < AND: "and"> | < OR: "or"> | < DEC: "dec"> | <

Relacionados

  • Assembly javacc
    1321 palavras | 6 páginas
  • infraestrutura de rede
    2405 palavras | 10 páginas
  • ouhfd
    868 palavras | 4 páginas
  • COMPILADORES
    22628 palavras | 91 páginas
  • 201728346 Linguagem De Programacao Go Google Apostila Livro Curso Docx
    142137 palavras | 569 páginas