[antlr-interest] Changing/affecting the Lexer from the Parser?

Juancarlo Añez apalala at gmail.com
Tue Nov 13 15:31:22 PST 2012


Bernard,

Thanks for all your help. You've made me think better. I now know what my
options are.

Cheers,


On Mon, Nov 12, 2012 at 2:18 AM, Bernard Kaiflin <bkaiflin.ruby at gmail.com>wrote:

> Ola,
>
> It seems you are in charge of the grammar. So I suppose that there is no
> FLOAT rule and you have INT DOT INT each time there is `1.2`in the input.
> Taken at the beginning of the thread, your requirements are
>
> ARR(1:5)
> ARR(1.2:4)
> ARR(1.#I:#J)
> ARR(#I.2:4), in which .2 is a valid floating point number, but 1. isn't.
>
> I don't understand .2 as float as start position. Without a description of
> the specifications and the purpose of the notation, it's hard to help you.
> If I call index the digit/variable before the dot, a full description of
> array could be :
>
> array : 'ARR' '(' index? dimension ')' ;
> index : d_v '.' ;
> d_v   : DIGIT | variable ;
> variable : '#' ID ;
> dimension : d_v ':' d_v ;
>
> HTH
> Bernard
>
>
> 2012/11/10 Juancarlo Añez <apalala at gmail.com>
>
>>  Bernard,
>>
>> On Sat, Nov 10, 2012 at 4:35 PM, Bernard Kaiflin <bkaiflin.ruby at gmail.com
>> >wrote:
>>
>> > to match the pre-generated token stream and programmatically split
>> > $FLOAT.text into two parts : index and start (dimension).
>>
>>
>> That patch is also an option I had thought of before, but it's an ugly
>> patch.
>>
>> I also have to deal with #I.2 and 1.#X, and #X.#Z, which are currently
>> dealt with by making ID consume both sides of the dot, just for parsing's
>> sake.
>>
>> -- Juanca
>>
>>
>>
>> --
>>
>> Juancarlo *Añez*
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>
>
>


-- 
Juancarlo *Añez*


More information about the antlr-interest mailing list