Re: D Grammar in BNF Text Form?

2014-06-10 Thread Bruno Medeiros via Digitalmars-d
On 06/06/2014 23:40, Brian Schott wrote: On Friday, 6 June 2014 at 22:25:16 UTC, Tom Browder via Digitalmars-d wrote: Now I'm confused--the three files I've found have differences in production rules--it looks like I'll have to look at what the compiler is actually doing--I'm putting that off f

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Tom Browder via Digitalmars-d
On Sun, Jun 8, 2014 at 3:58 AM, Jacob Carlborg via Digitalmars-d wrote: ... > You can start by filing an issue, including the input source used. If you > then manage to reduce the test case that's even better. I just don't want > the issue to get lost. Issue just filed as #26. I got the test cas

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Tom Browder via Digitalmars-d
On Sun, Jun 8, 2014 at 4:11 AM, Jacob Carlborg via Digitalmars-d wrote: > On 2014-06-08 10:33, Dicebot wrote: > >> AFAIR `gcc- E` output is not a valid C on its own, no wonder libclang >> chokes on it. Using llvm/clang toolchain with dstep results in much more >> pleasant experience (not surprisin

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-08 10:33, Dicebot wrote: AFAIR `gcc- E` output is not a valid C on its own, no wonder libclang chokes on it. Using llvm/clang toolchain with dstep results in much more pleasant experience (not surprisingly as dstep is implemented on top of it) Hmm, it adds a bunch of lines looking l

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 23:15, Tom Browder via Digitalmars-d wrote: Ditto. It might be a while, though. You can start by filing an issue, including the input source used. If you then manage to reduce the test case that's even better. I just don't want the issue to get lost. -- /Jacob Carlborg

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 23:16, Tom Browder via Digitalmars-d wrote: That's another itch! That's what the dtoh tool is for. It might create bindings for C++, I'm not sure. -- /Jacob Carlborg

Re: D Grammar in BNF Text Form?

2014-06-08 Thread Dicebot via Digitalmars-d
On Saturday, 7 June 2014 at 17:46:06 UTC, Tom Browder via Digitalmars-d wrote: On Sat, Jun 7, 2014 at 12:05 PM, Tom Browder wrote: On Sat, Jun 7, 2014 at 11:26 AM, Jacob Carlborg via Digitalmars-d wrote: ... There's already a tool for that [1]. It uses the JSON output from the compiler. [

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Sat, Jun 7, 2014 at 3:17 PM, Jacob Carlborg via Digitalmars-d wrote: ... > I just though you want to create C bindings for a D library, since you asked > about the D grammar. That's another itch! Best, -Tom

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Sat, Jun 7, 2014 at 3:19 PM, Jacob Carlborg via Digitalmars-d wrote: > On 2014-06-07 19:45, Tom Browder via Digitalmars-d wrote: > >> And Jacob, when I try your dstep on a header preprocessed with gcc -E >> I don't get very far: > > > Could you try without preprocessing the file first? It shoul

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 19:45, Tom Browder via Digitalmars-d wrote: And Jacob, when I try your dstep on a header preprocessed with gcc -E I don't get very far: Could you try without preprocessing the file first? It shouldn't crash regardless but just to see what happens. Could you also please file a

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 19:05, Tom Browder via Digitalmars-d wrote: Didn't you mean htod? It doesn't work on Linux. No, but I see now that I read your comment wrong. So yes, htod or DStep would be the appropriate tool for what you need. I just though you want to create C bindings for a D library, si

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Sat, Jun 7, 2014 at 12:05 PM, Tom Browder wrote: > On Sat, Jun 7, 2014 at 11:26 AM, Jacob Carlborg via Digitalmars-d > wrote: ... >> There's already a tool for that [1]. It uses the JSON output from the >> compiler. >> >> [1] https://github.com/D-Programming-Language/tools/blob/master/dtoh.d .

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Sat, Jun 7, 2014 at 11:26 AM, Jacob Carlborg via Digitalmars-d wrote: > On 2014-06-07 13:41, Tom Browder via Digitalmars-d wrote: > >> Again, my interest is in creating D bindings for a large C library and ... > There's already a tool for that [1]. It uses the JSON output from the > compiler. >

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 13:41, Tom Browder via Digitalmars-d wrote: Again, my interest is in creating D bindings for a large C library and to do it auto-magically, and this discussion is very enlightening and gives me some confidence that it is feasible. There's already a tool for that [1]. It uses the

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Sat, Jun 7, 2014 at 6:41 AM, Tom Browder wrote: ... > So the description in grammar.html is the official grammar > specification for the stable dmd compiler. Is there a plain text > version somewhere? Okay, now I see that page source is: https://github.com/D-Programming-Language/dlang.org/

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 6:24 PM, Brian Schott via Digitalmars-d wrote: > On Friday, 6 June 2014 at 23:08:41 UTC, Tom Browder via Digitalmars-d wrote: >> >> What about the lexer and parser info on the D lang site in the >> language reference. Is it current? > > https://issues.dlang.org/show_bug.cgi

Re: D Grammar in BNF Text Form?

2014-06-07 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-07 00:40, Brian Schott wrote: On Friday, 6 June 2014 at 22:25:16 UTC, Tom Browder via Digitalmars-d wrote: Now I'm confused--the three files I've found have differences in production rules--it looks like I'll have to look at what the compiler is actually doing--I'm putting that off f

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Brian Schott via Digitalmars-d
On Friday, 6 June 2014 at 23:08:41 UTC, Tom Browder via Digitalmars-d wrote: What about the lexer and parser info on the D lang site in the language reference. Is it current? https://issues.dlang.org/show_bug.cgi?id=10233 Language changes in D have traditionally started out as compiler chang

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 6:07 PM, Tom Browder wrote: ... > What about the lexer and parser info on the D lang site in the I should have been more precise and said the "lexical and grammar" sections of the language reference. on the D lang site Best, -Tom

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 5:40 PM, Brian Schott via Digitalmars-d wrote: > On Friday, 6 June 2014 at 22:25:16 UTC, Tom Browder via Digitalmars-d wrote: >> >> Now I'm confused--the three files I've found have differences in >> production rules--it looks like I'll have to look at what the ... > Use th

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Brian Schott via Digitalmars-d
On Friday, 6 June 2014 at 22:25:16 UTC, Tom Browder via Digitalmars-d wrote: Now I'm confused--the three files I've found have differences in production rules--it looks like I'll have to look at what the compiler is actually doing--I'm putting that off for a while unless someone has another id

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 2:26 PM, Brian Schott via Digitalmars-d wrote: > If you somehow manage to get any parser generator to correctly handle D, you > will be the first person in the world to have done so. Oops, fools rushing in, eh? > This may help: > https://github.com/Hackerpilot/DGrammar/blo

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Brian Schott via Digitalmars-d
On Friday, 6 June 2014 at 14:56:19 UTC, Tom Browder via Digitalmars-d wrote: Yes, thanks, but I really want one to use in Perl. Any idea of the value of k in LALR(k) for D? -Tom If you somehow manage to get any parser generator to correctly handle D, you will be the first person in the worl

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Nick Sabalausky via Digitalmars-d
On 6/6/2014 9:33 AM, Tom Browder via Digitalmars-d wrote: On Fri, Jun 6, 2014 at 7:00 AM, Robert Schadek via Digitalmars-d wrote: The site says it creates recursive decent parser. D does not even fit into lalr1. So it will not work, unless you can inject handwritten parse function for the criti

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 9:45 AM, Dejan Lekic via Digitalmars-d wrote: ... > Dscanner project has ANTLR grammer for D. It is unpolished, but works. It is > on Github. Yes, thanks, but I really want one to use in Perl. Any idea of the value of k in LALR(k) for D? -Tom

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Dejan Lekic via Digitalmars-d
On Friday, 6 June 2014 at 12:05:36 UTC, Robert Schadek via Digitalmars-d wrote: On 06/06/2014 12:29 PM, Tom Browder via Digitalmars-d wrote: Can anyone point me to a text version of the D grammar in some kind of BNF or EBNF format? The D lang web site's info is close, but it's buried in html

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 7:00 AM, Robert Schadek via Digitalmars-d wrote: > The site says it creates recursive decent parser. D does not even fit > into lalr1. So it will not work, unless you can inject handwritten parse > function for the critical parts Do you know the k value for the D language g

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 7:00 AM, Robert Schadek via Digitalmars-d wrote: > On 06/06/2014 12:29 PM, Tom Browder via Digitalmars-d wrote: ... >> My purpose is to attempt to write a D language parser in Perl using >> Damian Conway's Regex::Grammars module (on CPAN). ... > The site says it creates recu

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Robert Schadek via Digitalmars-d
On 06/06/2014 12:29 PM, Tom Browder via Digitalmars-d wrote: > Can anyone point me to a text version of the D grammar in some kind of > BNF or EBNF format? The D lang web site's info is close, but it's > buried in html which I'ld rather not have to wrestle with. > > My purpose is to attempt to wri

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
On Fri, Jun 6, 2014 at 5:32 AM, Philpax via Digitalmars-d On Friday, 6 June 2014 at 10:30:14 UTC, Tom Browder via Digitalmars-d wrote: >> Can anyone point me to a text version of the D grammar in some kind of >> BNF or EBNF format? The D lang web site's info is close, but it's >> buried in html w

Re: D Grammar in BNF Text Form?

2014-06-06 Thread Philpax via Digitalmars-d
On Friday, 6 June 2014 at 10:30:14 UTC, Tom Browder via Digitalmars-d wrote: Can anyone point me to a text version of the D grammar in some kind of BNF or EBNF format? The D lang web site's info is close, but it's buried in html which I'ld rather not have to wrestle with. My purpose is to att

D Grammar in BNF Text Form?

2014-06-06 Thread Tom Browder via Digitalmars-d
Can anyone point me to a text version of the D grammar in some kind of BNF or EBNF format? The D lang web site's info is close, but it's buried in html which I'ld rather not have to wrestle with. My purpose is to attempt to write a D language parser in Perl using Damian Conway's Regex::Grammars m