Re: [abc-users] grammar help

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Wed, 18 Mar 2009 12:31:09 -0600

Hi Eric
It seems it is not working for me, here is what I have in my ppg file

PC_FIRSTNUM:x LPAREN INTEGER_LITERAL:i RPAREN:y
        {:
            Grm.parserTrace("FIRSTNUM pointcut");
            RESULT =
parser.nf.PCFirstNum(parser.pos(x,y),i.getValue().intValue());
        :}

When I run abc with my extension I get the following:

World.aj:29: Illegal character "1"
   before() : firstNum(1000)
                        ^

World.aj:29: Illegal character "0"
   before() : firstNum(1000)
                         ^

World.aj:29: Illegal character "0"
   before() : firstNum(1000)
                          ^

World.aj:29: Illegal character "0"
   before() : firstNum(1000)
                           ^

World.aj:29: Syntax error: unexpected operator ).
   before() : firstNum(1000)
                            ^

Yes, I'm using polyglot, and I would really be happy if you can tell me
how to access the int number from the literal?

Thanks
Amjad

Eric Bodden wrote:
> Yes, that should be the right one. I am not sure what you mean by "how
> should I use it". Do you mean how to access the int number from the
> literal? If so, that depends on the frontend you are using. Are you
> using JastAdd or Polyglot? They both use different parser generators.
>
> Eric
>
> 2009/3/18 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> Hello
>> I want to extend the grammar in abc to something very simple. I want to
>> introduce a new PC that takes a parameter as an decimal integer literal.
>> Something like NewPC(1000). I dont want an identifier nor an expression ,
>> just a simple INT literal.
>> I'm looking at the java12.cup file and found an INTEGER_LITERAL, will that
>> help, if so, how should I use it?
>>
>> Thanks
>> Amjad
>>
>>
>>
>
>
>
>
Received on Wed Mar 18 2009 - 18:31:17 GMT

This archive was generated by hypermail 2.2.0 : Wed Mar 18 2009 - 18:50:12 GMT