Compiladores

2929 palavras 12 páginas
Analisador L´xico e

Linguagem Browson 1.0
Nat´lia Julieta,Felipe Luciani a

Macei´, junho de 2011 o

Linguagem Browson 1.0

Sum´rio a
1 Analisador L´xico e 2 Classe Item 3 Programa Browson - Teste 2 12 14

1

Linguagem Browson 1.0

1

Analisador L´xico e
Code 1: Analisador Lexico

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

package br . i c . u f a l . browson ; import j a v a . i o . F i l e ; import j a v a . i o . FileNotFoundException ; import j a v a . u t i l . A r r a y L i s t ; import j a v a . u t i l . L i s t ; import j a v a . u t i l . Scanner ; /∗ ∗ ∗ ∗ @author N a t a l i a J u l i e t a − F e l i p e L u c i a n i ∗ @version 1.0 ∗ @date 07 de junho de 2011 ∗ ∗/ public c l a s s A n a l i s a d o r L e x i c o { public s t a t i c f i n a l i n t TABELA DE TOKENS = 1 ; public s t a t i c f i n a l i n t TABELA DE SIMBOLOS = 2 ; public s t a t i c f i n a l i n t TABELA DE ERROS = 3 ; private i n t l i n h a ; private i n t c o l u n a ; private Scanner i n p u t ; private L i s t t a b e l a E r r o s ; private L i s t t a b e l a T o k e n s ; private L i s t t a b e l a S i m b o l o s ; /∗ ∗ ∗ @param f i l e ∗/ public A n a l i s a d o r L e x i c o ( S t r i n g f i l e ) { try { t h i s . i n p u t = new Scanner (new F i l e ( f i l e ) ) ; t h i s . t a b e l a E r r o s = new A r r a y L i s t () ; t h i s . t a b e l a T o k e n s = new A r r a y L i s t () ; t h i s . t a b e l a S i m b o l o s = new A r r a y L i s t () ; } catch ( FileNotFoundException e ) {

2

Linguagem Browson 1.0

50 51 52 53 54 55 56 57 58 59

System . e r r . p r i n t l n ( " File Not Found !!! " ) ; } } /∗ ∗ ∗ ∗/ public void s c a n ( ) { f o r ( t h i s . l i n h a = t h i s . c o l u n a = 1 ; t h i s . i n p u t . hasNext ( ) ; ++ this . linha , this . coluna = 1) scan ( this . input . nextLine ( ) ) ; } /∗ ∗ ∗ ∗ @param t a b l e

Relacionados

  • Compiladores
    568 palavras | 3 páginas
  • Compiladores
    2425 palavras | 10 páginas
  • Compiladores
    970 palavras | 4 páginas
  • Compiladores
    569 palavras | 3 páginas
  • compiladores
    780 palavras | 4 páginas
  • Compiladores
    1018 palavras | 5 páginas
  • Compiladores
    1037 palavras | 5 páginas
  • compiladores
    1300 palavras | 6 páginas
  • Compiladores
    9795 palavras | 40 páginas
  • Compiladores
    4177 palavras | 17 páginas