digitalmars.D.learn - Does the grammar allow an alias statement without a semicolon?
- Solomon E (12/12) Oct 17 2014 Hi, everyone, first post here. I'm trying to learn to parse D
- ketmar via Digitalmars-d-learn (6/9) Oct 17 2014 On Sat, 18 Oct 2014 00:52:22 +0000
- thedeemon (5/7) Oct 17 2014 Just in case, I'll remind these two projects that might be
- Solomon E (6/6) Oct 17 2014 Thank you both. That DGrammar project has some different names
- ketmar via Digitalmars-d-learn (4/10) Oct 17 2014 On Sat, 18 Oct 2014 02:54:21 +0000
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?
Oct 17 2014
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=20 http://dlang.org/grammar#AliasDeclaration is apparently missing a=20 semicolon after Declarator.this line should be removed altogether to stop people using this syntax. ;-) 'alias a =3D int;' is much better and clearer. and yes, this is a bug, semicolon is not optional there.
Oct 17 2014
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
Oct 17 2014
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.
Oct 17 2014
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=20 for the nonterminals in its grammar, and a different arrangement,=20 but it confirms there should be a semicolon with any alias=20 statement. I'm just trying to parse D when I read it myself so=20 far, and figure out how the grammar works a little. I'm not=20 trying to write a parser for it, at least not yet.btw, you can fill a bug report for this.
Oct 17 2014