Re: [abc-users] grammar help

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Wed, 18 Mar 2009 23:51:40 -0600

Yes, that is the case. I wrote the following in my AbcExtension

lexer.addPointcutKeyword("firstNum", new LexerAction_c(new
Integer(abc.bbs.parse.sym.PC_FIRSTNUM),new
Integer(lexer.pointcutifexpr_state())));

I used the lexer.pointcutifexpr_state(). I did not get any problem in
passing the INT to my aspectinfo.FirstNum class

Should I create my own state or can continue using the one above.

Thanks
Amjad

Eric Bodden wrote:
> The problem may be that the lexer thab abc uses is stateful. In
> particular it has a special pointcut state, in which INTEGER_LITERAL
> may not be an allowed token. You should be able to find this out by
> looking at the lexer definition (the .flex file). Then either modify
> and re-generate the lexer, or switch to an appropriate state when
> PC_FIRSTNUM is seen (you do the latter in
> AbcExtension.initLexerKeywords(AbcLexer)).
>
> Eric
>
> 2009/3/18 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> 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 Thu Mar 19 2009 - 05:51:57 GMT

This archive was generated by hypermail 2.2.0 : Thu Mar 19 2009 - 13:20:12 GMT