help-bison
[Top][All Lists]
Advanced

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

Re: indentations instead of endtag in a grammar


From: Andreas Wagner
Subject: Re: indentations instead of endtag in a grammar
Date: Wed, 17 Feb 2010 15:22:22 +0100

Thx for your fast answers. I will take a look.
@ Istvan is it possible that u send me the *.l & *.y files for python
(if u have them)?
Or post a link. Always when i search for python and .y or bison i just
find links to PyBison or PLY but no bison and lex file for Python.

2010/2/17, Hans Aberg <address@hidden>:
> On 17 Feb 2010, at 14:12, Andreas Wagner wrote:
>
>> The source code that I have to parse loks more like:
>>
>> if(signal):
>>  variable_a := do_something
>> else:
>>  variable_b := do_something_other
>>
>> variable_c := signal_x;
>>
>> How can i tell Bison that that it has to look for the indentations?
>> Has
>> anyone maybe an example that he/she can send me ? it would be very
>> helpful,
>> because i havent seen such an example.
>
> You might look into the sources of the Haskell interpreter Hugs
> <http://haskell.org/hugs/
>  >, which I recall uses .y files. (Haskell admits layout syntax.)
>
> My guess is though that you have to put a rule in the .l file that
> recognizes the indentation, that is to be recognized.
>
> If the syntax is good, it might be possible to do it with sufficient
> lookahead ( a different type of language specification). There the GLR
> parser might be used (se the Bison manual).
>
>    Hans
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]