Thread overview |
---|
October 18, 2014 Does the grammar allow an alias statement without a semicolon? | ||||
---|---|---|---|---|
| ||||
Hi, everyone, first post here. I'm trying to learn to parse D code. The line "alias StorageClassesopt BasicType Declarator" in http://dlang.org/grammar#AliasDeclaration is apparently missing a semicolon after Declarator. If that line is not missing a semicolon, could someone please explain how it's possible to parse D, given that according to the grammar with that line taken literally, some statements may come after each other without a semicolon, and some statements may end with one of the keywords "const", "immutable", "inout", or "shared", which are keywords that come at the beginning of some other statements? |
October 18, 2014 Re: Does the grammar allow an alias statement without a semicolon? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Solomon E Attachments: | On Sat, 18 Oct 2014 00:52:22 +0000 Solomon E via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > The line "alias StorageClassesopt BasicType Declarator" in http://dlang.org/grammar#AliasDeclaration is apparently missing a semicolon after Declarator. this line should be removed altogether to stop people using this syntax. ;-) 'alias a = int;' is much better and clearer. and yes, this is a bug, semicolon is not optional there. |
October 18, 2014 Re: Does the grammar allow an alias statement without a semicolon? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Solomon E | On Saturday, 18 October 2014 at 00:52:23 UTC, Solomon E wrote: > Hi, everyone, first post here. I'm trying to learn to parse D code. Just in case, I'll remind these two projects that might be helpful: https://github.com/Hackerpilot/libdparse https://github.com/Hackerpilot/DGrammar |
October 18, 2014 Re: Does the grammar allow an alias statement without a semicolon? | ||||
---|---|---|---|---|
| ||||
Posted in reply to thedeemon | Thank you both. That DGrammar project has some different names for the nonterminals in its grammar, and a different arrangement, but it confirms there should be a semicolon with any alias statement. I'm just trying to parse D when I read it myself so far, and figure out how the grammar works a little. I'm not trying to write a parser for it, at least not yet. |
October 18, 2014 Re: Does the grammar allow an alias statement without a semicolon? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Solomon E Attachments: | On Sat, 18 Oct 2014 02:54:21 +0000 Solomon E via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > Thank you both. That DGrammar project has some different names for the nonterminals in its grammar, and a different arrangement, but it confirms there should be a semicolon with any alias statement. I'm just trying to parse D when I read it myself so far, and figure out how the grammar works a little. I'm not trying to write a parser for it, at least not yet. btw, you can fill a bug report for this. |
Copyright © 1999-2021 by the D Language Foundation