Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
December 29, 2013 lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Are there any good lexer and parser libraries (like flex/bison) for D? If not, how much work would be involved in using flex and bison and wrapping it to D? How straightforward is it to pass a struct from C to D (the documentation http://dlang.org/struct.html just says that D structs go directly to C -- the other way holds too if the C side is written in a certain way, but gives no examples of what is needed on both sides)? |
December 29, 2013 Re: lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan | On Sunday, 29 December 2013 at 19:25:46 UTC, Jonathan wrote: > Are there any good lexer and parser libraries (like flex/bison) for D? If not, how much work would be involved in using flex and bison and wrapping it to D? How straightforward is it to pass a struct from C to D (the documentation http://dlang.org/struct.html just says that D structs go directly to C -- the other way holds too if the C side is written in a certain way, but gives no examples of what is needed on both sides)? A POD struct in D is interchangeable with C structs, both ways. You just have to make the declaration of the struct in both languages. Lexers/Parsers: https://github.com/PhilippeSigaud/Pegged and https://github.com/Hackerpilot/Dscanner |
December 29, 2013 Re: lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan | On Sunday, 29 December 2013 at 19:25:46 UTC, Jonathan wrote: > Are there any good lexer and parser libraries (like flex/bison) for D? If not, how much work would be involved in using flex and bison and wrapping it to D? How straightforward is it to pass a struct from C to D (the documentation http://dlang.org/struct.html just says that D structs go directly to C -- the other way holds too if the C side is written in a certain way, but gives no examples of what is needed on both sides)? See http://dlang.org/htomodule.html Also you may read http://www.gamedev.net/blog/1140/entry-2254003-binding-d-to-c/ |
December 29, 2013 Re: lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan | There is also http://www.semitwist.com/goldie/ but I did not use it. |
December 30, 2013 Re: lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan | If you like Parser Expression Grammar there's Pegged: https://github.com/PhilippeSigaud/Pegged |
December 30, 2013 Re: lexer/parser library for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to FreeSlave | On 12/30/2013 5:36 AM, FreeSlave wrote: > > Also you may read > http://www.gamedev.net/blog/1140/entry-2254003-binding-d-to-c/ Better to go to [1], where I combined that series of posts into a single article and updated a few things, too. [1] http://www.gamedev.net/page/resources/_/technical/game-programming/binding-d-to-c-r3122 |
Copyright © 1999-2021 by the D Language Foundation