On Sunday 31 July 2011 12:28:29 Alex Rønne Petersen wrote: > On 31-07-2011 12:24, Jonathan M Davis wrote: > > On Sunday 31 July 2011 12:01:02 Alex Rønne Petersen wrote: > >> On 31-07-2011 11:57, Jacob Carlborg wrote: > >>> Have a look at Derelict: http://dsource.org/projects/derelict/ > >>> It wraps OpenGL, OpenAL and other game/multimedia related libraries. > >> > >> That looks nice. Are there any plans for OpenCL support? > >> > >>> I think someone is working on this. > >> > >> I know of the Goldie project. Is this it? > > > > Off and on, I've been working on porting dmd's lexer to D for Phobos, > > but I've had enough else going on, that I haven't gotten much done on > > it of late. And there is some controversy on the matter, because Andrei > > and others want a lexer/parser generator in Phobos rather than a > > hand-written lexer and parser. Both are of value though. So, I don't > > know what we'll end up with in the end. I'm not aware of anyone working > > on a lexer or parser generator for Phobos though. Goldie is the closest > > to that sort of thing that there is at the moment. I think that Jacob > > was referring to my efforts to port the dmd lexer though. > > > > - Jonathan M Davis > > A generator is what I had in mind - it would allow users to more easily > approach parsing, I think. Hand-written parsers have a much greater > learning curve. > > I do agree on both ideas though; a built-in parser for D would probably > be pretty useful to have for extracting information from D source code. > > An interesting exercise would be generating a lexer/parser via CTFE and > mixins. :) Perhaps we don't really need dlex/dyacc tools if we could do > something like that.
The idea behind the hand-written D lexer (and eventually parser) for D is that it follows the implementation of the compiler's front-end, and so using it to process D code will have the same result as running the compiler. It obviously doesn't scale beyond D itself. If you have a lexer generator and/or parser parser generator, then you can get it to generate a lexer or parser for any grammar that you want. So, it covers a different use case - which is why both are of value. Personally, I'd probably want to write a parser by hand anyway, since there are definite advantages in doing so, but there's no reason why Phobos shouldn't have a generator for that for those who want it. Someone still needs to write it though. - Jonathan M Davis
