[Pharo-project] Initial PetitC parser

Ricardo Moran richi.moran at gmail.com
Fri Apr 8 21:30:36 CEST 2011


On Fri, Apr 8, 2011 at 1:49 PM, Javier Pimás <elpochodelagente at gmail.com>wrote:

> On Fri, Apr 8, 2011 at 3:41 AM, Tudor Girba <tudor.girba at gmail.com> wrote:
>
>> Hi Javier,
>>
>> On 8 Apr 2011, at 05:37, Javier Pimás wrote:
>>
>> > Hi,
>> >      I took some time to start developing a C parser with PetitParser. I
>> used the slides of the smalltalk school, they were pretty useful, and after
>> some hours I have a very basic tokens scanner. The idea of this work is to
>> be able to feed the parser with C headers and automagically get the C
>> bindings done in smalltalk.
>>
>>
>> Nice. I took a quick look. If you want to scale, please write tests (one
>> small example per test). Grammars become complex and if you do not have
>> close to 100% coverage, you will get stuck.
>>
>>
> OK, I'll try. One question regarding PP: I started coding by looking at
> PPArithmeticParser, and noticed that for each sub-grammar you have a method
> and an instance named the same way, is that a requirement? If I don't add
> the instances this sub-grammars are not shown in the PPBrowser.
>

Yes, I think it is a requirement. Otherwise, the parsers can't be
initialized. Look at: PPCompositeParser>>#initializeStartingAt:



>
> Regards,
>             Javier.
>
> Cheers,
>> Doru
>>
>>
>>
>> > Now I have to actually start doing something with the scanned code. How
>> should I do that, all in the same class? What if I want to generate bindings
>> for different kinds of FFIs? Other question, how should I handle
>> preprocessing? (now there isn't any kind of preprocessing)
>> >
>> > You can see the code, download it and commit improvements to the repo at
>> www.squeaksource.com/Bindings
>> >
>> > Anybody who is interested is welcomed to help in the development!
>> >
>> > Regards,
>> >           Javier.
>> >
>> > --
>> > Javier Pimás
>> > Ciudad de Buenos Aires
>>
>> --
>> www.tudorgirba.com
>>
>> "Sometimes the best solution is not the best solution."
>>
>>
>>
>
>
> --
> Javier Pimás
> Ciudad de Buenos Aires
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110408/c7581791/attachment.htm>


More information about the Pharo-project mailing list