Re: Official D Grammar

2013-07-20 Thread Michael
On Friday, 19 July 2013 at 20:49:27 UTC, Brian Schott wrote: Status update: excluding c-style array declarations, which I'm convinced are broken and should be removed from the language +1 I found for myself that "native" style arrays are more natural.

Re: Official D Grammar

2013-07-20 Thread Jacob Carlborg
On 2013-07-19 22:49, Brian Schott wrote: Status update: My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language). I've been updating the grammar definition as I worked on the par

Re: Official D Grammar

2013-07-19 Thread Johannes Pfau
Am Fri, 19 Jul 2013 22:49:25 +0200 schrieb "Brian Schott" : > Status update: > > My parser is at a point where it can parse all of phobos (well, > excluding c-style array declarations, which I'm convinced are > broken and should be removed from the language). > > I've been updating the grammar

Re: Official D Grammar

2013-07-19 Thread Mr. Anonymous
On Friday, 19 July 2013 at 20:49:27 UTC, Brian Schott wrote: Status update: My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language). I've been updating the grammar definition

Re: Official D Grammar

2013-07-19 Thread Brian Schott
On Friday, 19 July 2013 at 20:57:14 UTC, H. S. Teoh wrote: Really? Those still exist in Phobos? Shouldn't they be rewritten to the "native" style? Yes. https://github.com/D-Programming-Language/phobos/pull/1412/files

Re: Official D Grammar

2013-07-19 Thread Brian Schott
On Friday, 19 July 2013 at 20:52:33 UTC, Mr. Anonymous wrote: https://rawgithub.com/Hackerpilot/DGrammar/master/grammar.html ;) I learn something new every day.

Re: Official D Grammar

2013-07-19 Thread Brian Schott
Status update: My parser is at a point where it can parse all of phobos (well, excluding c-style array declarations, which I'm convinced are broken and should be removed from the language). I've been updating the grammar definition as I worked on the parser. An HTML version is available for

Re: Official D Grammar

2013-07-19 Thread H. S. Teoh
On Fri, Jul 19, 2013 at 10:49:25PM +0200, Brian Schott wrote: > Status update: > > My parser is at a point where it can parse all of phobos (well, > excluding c-style array declarations, which I'm convinced are broken > and should be removed from the language). Really? Those still exist in Phobos

Re: Official D Grammar

2013-06-03 Thread Brian Schott
As threatened at DConf, I've started filing bugs against the grammar specification. Anyone interested can track bug 10233[1], which I've marked as blocked by the various issues I've been finding. As usual, my best guess at D's actual grammar[2] is located here[3]. Top secret project is hint

Re: Official D Grammar

2013-05-12 Thread Brian Schott
I wrote a small program to take the grammar and generate input to the dot program from Graphviz. You can generate the diagrams with some scripts available on Github or view a prebuilt version here: http://hackerpilot.org/d/dgrammar.zip Please take a look at this and let me know if you find any

Re: Official D Grammar

2013-05-03 Thread Tobias Pankrath
On Thursday, 2 May 2013 at 17:13:46 UTC, Russel Winder wrote: On Thu, 2013-05-02 at 17:44 +0100, Bruno Medeiros wrote: […] To be honest, that's one of the reasons that put me off working with ANLTR. It seems easy to create a parser with ANTLR, but to create an efficient, well-behaved parser it

Re: Official D Grammar

2013-05-02 Thread Brian Schott
On Thursday, 2 May 2013 at 16:44:44 UTC, Bruno Medeiros wrote: (at moments it feels like you have to take a degree to learn how to use it effectively...) That or buy the documentation. Or both...

Re: Official D Grammar

2013-05-02 Thread Russel Winder
On Thu, 2013-05-02 at 17:44 +0100, Bruno Medeiros wrote: […] > To be honest, that's one of the reasons that put me off working with > ANLTR. It seems easy to create a parser with ANTLR, but to create an > efficient, well-behaved parser it looks quite complicated, in the sense > that you can't ab

Re: Official D Grammar

2013-05-02 Thread Bruno Medeiros
On 26/04/2013 21:44, Brian Schott wrote: On Saturday, 20 April 2013 at 08:31:34 UTC, Brian Schott wrote: This uses ANTLR, as the other parser generators can't handle D's grammar. I'm beginning to think that ANTRL is not up to the task either. I've somehow managed to get the grammar to the poin

Re: Official D Grammar

2013-05-01 Thread Russel Winder
On Wed, 2013-05-01 at 17:34 +0200, Tobias Pankrath wrote: > On Friday, 26 April 2013 at 20:44:12 UTC, Brian Schott wrote: > > On Saturday, 20 April 2013 at 08:31:34 UTC, Brian Schott wrote: > >> This uses ANTLR, as the other parser generators can't handle > >> D's grammar. Which other parser gene

Re: Official D Grammar

2013-05-01 Thread Tobias Pankrath
On Friday, 26 April 2013 at 20:44:12 UTC, Brian Schott wrote: On Saturday, 20 April 2013 at 08:31:34 UTC, Brian Schott wrote: This uses ANTLR, as the other parser generators can't handle D's grammar. I'm beginning to think that ANTRL is not up to the task either. I've somehow managed to get t

Re: Official D Grammar

2013-04-28 Thread Andrei Alexandrescu
On 4/28/13 8:16 PM, Brian Schott wrote: On Friday, 26 April 2013 at 20:44:12 UTC, Brian Schott wrote: I'm beginning to think that ANTRL is not up to the task either. I've somehow managed to get the grammar to the point where it correctly parses several phobos modules but takes a half hour to do

Re: Official D Grammar

2013-04-28 Thread Brian Schott
On Friday, 26 April 2013 at 20:44:12 UTC, Brian Schott wrote: I'm beginning to think that ANTRL is not up to the task either. I've somehow managed to get the grammar to the point where it correctly parses several phobos modules but takes a half hour to do so. I think I'm done with this gramma

Re: Official D Grammar

2013-04-26 Thread Brian Schott
On Saturday, 20 April 2013 at 08:31:34 UTC, Brian Schott wrote: This uses ANTLR, as the other parser generators can't handle D's grammar. I'm beginning to think that ANTRL is not up to the task either. I've somehow managed to get the grammar to the point where it correctly parses several phob

Re: Official D Grammar

2013-04-25 Thread Jonathan M Davis
On Wednesday, April 24, 2013 08:39:21 Jacob Carlborg wrote: > On 2013-04-24 03:40, Jonathan M Davis wrote: > > That would mean creating more keywords, which would break code. By using > > @, we avoid having to create new keywords, which I believe was the whole > > point in the first place. Which at

Re: Official D Grammar

2013-04-24 Thread Paulo Pinto
On Wednesday, 24 April 2013 at 01:40:52 UTC, Jonathan M Davis wrote: On Tuesday, April 23, 2013 21:51:54 Stewart Gordon wrote: Er, do away with the meaningless @? Since nobody seems to have succeeded in explaining how the @-attributes differ from the rest, it seems the right way to go. That

Re: Official D Grammar

2013-04-23 Thread Jacob Carlborg
On 2013-04-24 03:40, Jonathan M Davis wrote: That would mean creating more keywords, which would break code. By using @, we avoid having to create new keywords, which I believe was the whole point in the first place. Which attributes got @ on them was fairly arbitrary, but they do definitely ser

Re: Official D Grammar

2013-04-23 Thread Jonathan M Davis
On Wednesday, April 24, 2013 00:34:54 Diggory wrote: > If at some point custom attributes will be allowed, @ would be a > nice syntax for that. > > Things like @safe could be attributes implemented by the standard > library - would cut down on the number of keywords. We already have custom attrib

Re: Official D Grammar

2013-04-23 Thread Jonathan M Davis
On Tuesday, April 23, 2013 21:51:54 Stewart Gordon wrote: > Er, do away with the meaningless @? Since nobody seems to have > succeeded in explaining how the @-attributes differ from the rest, it > seems the right way to go. That would mean creating more keywords, which would break code. By using @

Re: Official D Grammar

2013-04-23 Thread Diggory
If at some point custom attributes will be allowed, @ would be a nice syntax for that. Things like @safe could be attributes implemented by the standard library - would cut down on the number of keywords.

Re: Official D Grammar

2013-04-23 Thread Stewart Gordon
On 02/04/2013 03:13, Walter Bright wrote: On 4/1/2013 4:18 PM, Brian Schott wrote: 1) Grammar defined in terms of things that aren't tokens. Take, for example, PropertyDeclaration. It's defined as an "@" token followed by... what? "safe"? It's not a real token. It's an identifier. You can't pa

Re: Official D Grammar

2013-04-20 Thread Timon Gehr
On 04/20/2013 08:36 PM, Walter Bright wrote: On 4/9/2013 3:20 AM, Bruno Medeiros wrote: A bit more annoying is the case with the extern declaration, with the C++ parameter: extern(C++) here you have to look at a special identifier (the C, D, PASCAL part) and see if there is a ++ token ahead,

Re: Official D Grammar

2013-04-20 Thread Walter Bright
On 4/9/2013 3:20 AM, Bruno Medeiros wrote: A bit more annoying is the case with the extern declaration, with the C++ parameter: extern(C++) here you have to look at a special identifier (the C, D, PASCAL part) and see if there is a ++ token ahead, it's a bit more of special-casing in the parse

Re: Official D Grammar

2013-04-20 Thread Dmitry Olshansky
20-Apr-2013 12:31, Brian Schott пишет: I've moved my work on the grammar to the following location on Github: https://github.com/Hackerpilot/DGrammar This uses ANTLR, as the other parser generators can't handle D's grammar. Great. IMHO ANTLR is one of the sanest. > Several rules from the off

Re: Official D Grammar

2013-04-20 Thread Brian Schott
I've moved my work on the grammar to the following location on Github: https://github.com/Hackerpilot/DGrammar This uses ANTLR, as the other parser generators can't handle D's grammar. Several rules from the official grammar were removed, and several others were added (Such as an actual rule

Re: Official D Grammar

2013-04-09 Thread Jacob Carlborg
On 2013-04-02 04:13, Walter Bright wrote: 1) Grammar defined in terms of things that aren't tokens. Take, for example, PropertyDeclaration. It's defined as an "@" token followed by... what? "safe"? It's not a real token. It's an identifier. You can't parse this based on checking the token type.

Re: Official D Grammar

2013-04-09 Thread Artur Skawina
On 04/09/13 12:24, Bruno Medeiros wrote: > On 07/04/2013 16:14, Artur Skawina wrote: >>> The "1..2" is actually mentioned in the spec: >>> >"An exception to this rule is that a .. embedded inside what looks like >>> >two floating point literals, as in 1..2, is interpreted as if the .. was >>> >se

Re: Official D Grammar

2013-04-09 Thread Bruno Medeiros
On 02/04/2013 03:13, Walter Bright wrote: 1) Grammar defined in terms of things that aren't tokens. Take, for example, PropertyDeclaration. It's defined as an "@" token followed by... what? "safe"? It's not a real token. It's an identifier. You can't parse this based on checking the token type.

Re: Official D Grammar

2013-04-09 Thread Bruno Medeiros
On 07/04/2013 16:14, Artur Skawina wrote: The "1..2" is actually mentioned in the spec: >"An exception to this rule is that a .. embedded inside what looks like two floating point literals, as in 1..2, is interpreted as if the .. was separated by a space from the first integer." >so it's there,

Re: Official D Grammar

2013-04-08 Thread Philippe Sigaud
> However in an old discussion someone said that the D grammar isn't LALR(1) > or LR(1), so I don't think that is possible with current D parser > generators. Do we have a pegged grammar for D? > Yes, it comes with the project. But, it's still buggy (sometimes due to my own mistakes, sometimes due

Re: Official D Grammar

2013-04-08 Thread Tobias Pankrath
On Monday, 8 April 2013 at 21:50:12 UTC, Christopher Bergqvist wrote: On Tuesday, 2 April 2013 at 19:00:21 UTC, Tobias Pankrath wrote: I'm wondering if it's possibly to mechanically check that what's in the grammar is how DMD behaves. Take the grammar and (randomly) generate strings with it

Re: Official D Grammar

2013-04-08 Thread Christopher Bergqvist
On Tuesday, 2 April 2013 at 19:00:21 UTC, Tobias Pankrath wrote: I'm wondering if it's possibly to mechanically check that what's in the grammar is how DMD behaves. Take the grammar and (randomly) generate strings with it and check if DMD does complain. You'd need a parse only don't check s

Re: Official D Grammar

2013-04-07 Thread Artur Skawina
On 04/07/13 00:35, Bruno Medeiros wrote: > On 06/04/2013 20:52, Artur Skawina wrote: >> On 04/06/13 17:21, Bruno Medeiros wrote: >>> On 02/04/2013 00:18, Brian Schott wrote: I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some prog

Re: Official D Grammar

2013-04-06 Thread Bruno Medeiros
On 06/04/2013 20:52, Artur Skawina wrote: On 04/06/13 17:21, Bruno Medeiros wrote: On 02/04/2013 00:18, Brian Schott wrote: I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some progress on the other (three?) modules being reviewed before

Re: Official D Grammar

2013-04-06 Thread Artur Skawina
On 04/06/13 17:21, Bruno Medeiros wrote: > On 02/04/2013 00:18, Brian Schott wrote: >> I've pretty much finished up my work on the std.d.lexer module. I am >> waiting for the review queue to make some progress on the other (three?) >> modules being reviewed before starting a thread on it. >> > > B

Re: Official D Grammar

2013-04-06 Thread Jonathan M Davis
On Saturday, April 06, 2013 16:21:12 Bruno Medeiros wrote: > On 02/04/2013 00:18, Brian Schott wrote: > > I've pretty much finished up my work on the std.d.lexer module. I am > > waiting for the review queue to make some progress on the other (three?) > > modules being reviewed before starting a th

Re: Official D Grammar

2013-04-06 Thread Bruno Medeiros
On 02/04/2013 00:18, Brian Schott wrote: I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some progress on the other (three?) modules being reviewed before starting a thread on it. BTW, even in the lexer spec I've found an issue. How doe

Re: Official D Grammar

2013-04-06 Thread Bruno Medeiros
On 02/04/2013 00:18, Brian Schott wrote: I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some progress on the other (three?) modules being reviewed before starting a thread on it. In the meantime I've started some work on an AST module fo

Re: Official D Grammar

2013-04-02 Thread Tobias Pankrath
I'm wondering if it's possibly to mechanically check that what's in the grammar is how DMD behaves. Take the grammar and (randomly) generate strings with it and check if DMD does complain. You'd need a parse only don't check semantics flag, though. This will not check if the strings are pa

Re: Official D Grammar

2013-04-02 Thread Jacob Carlborg
On 2013-04-02 15:21, Stewart Gordon wrote: Indeed, the published grammar needs to be thoroughly checked against what DMD is actually doing, and any discrepancies fixed (or filed in Bugzilla to be fixed in due course). And then they need to be kept in sync. Has the idea of using a parser genera

Re: Official D Grammar

2013-04-02 Thread Stewart Gordon
On 02/04/2013 00:18, Brian Schott wrote: I think that we need to be able to create a grammar description that: * Fits in to a single file, so that a tool implementer does not need to collect bits of the grammar from the various pages on dlang.org. * Can be verified to be correct by an existing t

Re: Official D Grammar

2013-04-01 Thread Walter Bright
On 4/1/2013 4:18 PM, Brian Schott wrote: I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some progress on the other (three?) modules being reviewed before starting a thread on it. In the meantime I've started some work on an AST module fo

Official D Grammar

2013-04-01 Thread Brian Schott
I've pretty much finished up my work on the std.d.lexer module. I am waiting for the review queue to make some progress on the other (three?) modules being reviewed before starting a thread on it. In the meantime I've started some work on an AST module for Phobos that contains the data types