Re: [q-lang-users] silly regex wonderings
Brought to you by:
agraef
From: <Dr....@t-...> - 2004-11-29 11:50:22
|
Tim Haynes wrote: > Could we FFI-in libfl, using your magic SWIG thing? :) Sure, but does it export something that you might wish to use directly in a Q script? I thought that this lib just contains some internal stuff used by a flex-generated lexer? The cheap way to go about a Q lex/yacc would be to have preprocessors for C lex/yacc (or flex/bison) whose input would basically be a lex/yacc grammar with the actions and auxiliary code written in Q instead of C. The preprocessors would then generate the corresponding C code and use lex/yacc and qcc to translate the result to an external Q module with yyparse/yylex functions which could be called from a Q script. The first version of these tools could implement a minimal subset of the preprocessor languages, which would be done by hand, and then we could bootstrap the full version from there. Of course it would be nicer to have tools written entirely in Q (a la Alex/Happy for Haskell), but that would be much more work, and it would also be difficult to implement the lexer (which is the major bottleneck in any parser) in a way which achieves comparable performance to a C-based one. As you can see, I have already spent some time thinking about this, but I just can't find the time to implement it. ;-) > (Can't offer to do this myself atm; I'm going to be quiet a while, > something to do with buying a house...) Good luck. :) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikwissenschaft.uni-mainz.de/~ag |