
Duncan Coutts:
On Wed, 2005-06-08 at 21:12 +1000, Manuel M T Chakravarty wrote:
Duncan Coutts:
On Wed, 2005-06-01 at 22:16 +1000, Manuel M T Chakravarty wrote:
Sounds good to me.
You can review the cleaned up versions of the lexer and parser here: http://cvs.sourceforge.net/viewcvs.py/gtk2hs/gtk2hs/tools/c2hs/c/CLexer2.x?only_with_tag=branch-0-9-8&view=markup http://cvs.sourceforge.net/viewcvs.py/gtk2hs/gtk2hs/tools/c2hs/c/CParser2.y?only_with_tag=branch-0-9-8&view=markup
Looks great! Just two minor points:
* In CLexer2.idkwtok, why didn't you use string literals (but explicit lists of characters instead)?
Because GHC translates the former into a sequence of string comparisons, but the latter using its effecient pattern matching algorithm. So the former is a linear search, the latter is more like a trie. It makes a significant difference to the speed of the lexer. We could of course use an explicit trie data structure if we had one to hand.
Ah! Bad GHC...
* I also prefer lines with max. 80 characters (I usually work on my laptop and its screen is not that big).
Ok, I'll see if I can reformat it before submitting it.
Thanks!
So, if you would prepare a patch against the mainline c2hs in the darcs repo, I'd be more than happy to replace the existing lexer and parser with your new version.
Great! I fear I may have to leave the required build system changes to you. We're using a different build system.
No problem. I am grateful for the effort you made to implement this in the first place. Manuel