[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting [1,1] expecting: EOF no matter what



hi there
here is what I get
it's sablecc 3.1 running on OSX tiger
thanks in advance
-----------
tiger:~/Desktop/sablecc-3.1/bin jorge$ cat example.txt
if work then happy end

tiger:~/Desktop/sablecc-3.1/bin jorge$ java Main example.txt
org.sablecc.baba.parser.ParserException: [1,1] expecting: EOF

tiger:~/Desktop/sablecc-3.1/bin jorge$ java -version
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-215.0.84)
Java HotSpot(TM) Client VM (build 1.4.2-51.0.81, mixed mode)
---------------
On 10/27/06, Etienne Gagnon <egagnon@xxxxxxxxxxx> wrote:
Hi Jorge,

I've tested with the following files, and it works fine.

$ java -jar sablecc.jar grammar.sablecc
$ javac Main.java
$ java Main test.txt

Can you try with the attached files?

Etienne

Jorge Mario G. Mazo wrote:
> evey grammar I have tried I awlays get
> [1,1] expecting: EOF, if I move the first caracter of the example file
> ...

--
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/


Package org.sablecc.baba;

Helpers
  digitos    = ['0'..'9'];
  letras     = ['A'..'Z']|['a'..'z'];
  caracteres = ' '|digitos|letras;
  lf         = 10;
  cr         = 13;
  eol        = cr lf | cr | lf;
  blank      = 10 | 10 13 | 9 | ' ';

Tokens
  if    = 'if';
  then  = 'then';
  else  = 'else';
  while = 'while';
  for   = 'for';
  end   = 'end';
  do    = 'do';

  numero   = digitos+;
  variable = letras(letras|digitos)*;

  endofline  = eol;
  blanktoken = blank+;

Ignored Tokens
  endofline,
  blanktoken;

Productions
  programa =
    lista_decl;

  lista_decl =
    decl*;

  decl =
    variable;

  lista_instr =
    instr*;

  instr =
    {declaracion} decl |
    {if}          if variable then lista_instr end |
    {while}       while variable do lista_instr end |
    {for}         for variable do lista_instr end;


ahsh

_______________________________________________
SableCC-user mailing list
SableCC-user@xxxxxxxxxxx
http://sablecc.org/lists/control/listinfo/sablecc-user