On Fri, Apr 8, 2011 at 3:41 AM, Tudor Girba <tudor.girba@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. 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