digitalmars.D - Redundancy/conflicts in expression rules.
- Iain Buclaw (81/81) Feb 12 2014 This might be because the rules I have in place are not complete
- Brian Schott (3/7) Feb 12 2014 It's dangerous to go alone. Take this!
- Iain Buclaw (18/27) Feb 12 2014 Thanks! Having a look at D.g4, I'm seeing that you do the same with the...
- Iain Buclaw (3/17) Feb 12 2014 In any case, everything looks lean enough that I'll probably believe
- Walter Bright (2/4) Feb 12 2014 Should issue pull requests for errors found in the grammar!
- Iain Buclaw (2/7) Feb 12 2014 Will do ... in the morning.
- Brian Schott (2/13) Feb 12 2014 See_also: http://d.puremagic.com/issues/show_bug.cgi?id=10233
- Walter Bright (3/15) Feb 12 2014 Thank you. It's important to make such a log of all such errors you find...
- Iain Buclaw (3/27) Feb 13 2014 I checked over the already existing reports, and this is what I'm seeing...
- Brian Schott (8/13) Feb 12 2014 Use of my parser keeps finding places where my grammar is wrong.
- Kenji Hara (4/25) Feb 12 2014 In git head, 'Grammar' page is added.
- Iain Buclaw (2/27) Feb 13 2014 Bleh, that contains the same mistakes!
- Walter Bright (4/10) Feb 14 2014 It should, because it should contain exactly the same grammar as is dist...
- Dejan Lekic (3/12) Feb 18 2014 Brian's ANTLR grammar file is one that matches closely current
- Marco Leise (5/15) Feb 18 2014 Is it a bad sign if I happen to remember the reference ? :p
- Steven Schveighoffer (4/17) Feb 18 2014 No, but it is bad if the "da da da DAAAAA" sound plays in your head whil...
- Rainer Schuetze (7/43) Feb 14 2014 I think this is by design to disallow comparison operators and binary
- Iain Buclaw (22/28) Feb 15 2014 Yeah, I didn't buy that argument at first. Not least because it didn't
- Iain Buclaw (12/22) Feb 18 2014 As soon as I introduced
This might be because the rules I have in place are not complete (I'm not implementing a complete D expression parser), but I have my doubts on this, and currently leaning on a possible problem in the documentation. I've built up rules in yacc based on what's documented here: http://dlang.org/expression.html However I seem to be getting shift/reduce conflicts around: AndAndExpression: OrExpression | AndAndExpression && OrExpression CmpExpression | AndAndExpression && CmpExpression ; OrExpression: XorExpression | OrExpression | XorExpression ; XorExpression: AndExpression | XorExpression ^ AndExpression ; AndExpression: ShiftExpression | AndExpression & ShiftExpression ; CmpExpression: ShiftExpression | EqualExpression | IdentityExpression | RelExpression ; CmpExpression: ShiftExpression | EqualExpression | IdentityExpression | RelExpression ; --- Conflict between 'XorExpression: XorExpression '^' AndExpression' and token '&' Conflict between 'ShiftExpression: ShiftExpression RSH AddExpression' and token '+' Conflict between 'ShiftExpression: ShiftExpression RSH AddExpression' and token '-' Conflict between 'ShiftExpression: ShiftExpression LSH AddExpression' and token '+' Conflict between 'ShiftExpression: ShiftExpression LSH AddExpression' and token '-' Conflict between 'AddExpression: AddExpression '+' MulExpression' and token '*' Conflict between 'AddExpression: AddExpression '-' MulExpression' and token '*' --- It's not too much of a problem, I can tweak it (so it follows same-ish rules as Java) and it will pass just fine: AndAndExpression: OrExpression | AndAndExpression && OrExpression ; OrExpression: XorExpression | OrExpression | XorExpression ; XorExpression: AndExpression | XorExpression ^ AndExpression ; AndExpression: CmpExpression | AndExpression & CmpExpression ; CmpExpression: ShiftExpression | EqualExpression | IdentityExpression | RelExpression ; I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.
Feb 12 2014
On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 12 2014
On 13 February 2014 00:06, Brian Schott <briancschott gmail.com> wrote:On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Thanks! Having a look at D.g4, I'm seeing that you do the same with the rules: andAndExpression: orExpression | andAndExpression '&&' orExpression ; /*...*/ andExpression: cmpExpression | andExpression '&' cmpExpression ; cmpExpression: shiftExpression | equalExpression | identityExpression | relExpression | inExpression ;I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 12 2014
On 13 February 2014 00:18, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 13 February 2014 00:06, Brian Schott <briancschott gmail.com> wrote:In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Thanks! Having a look at D.g4, I'm seeing that you do the same with the rules:I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 12 2014
On 2/12/2014 4:24 PM, Iain Buclaw wrote:In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 12 2014
On 13 February 2014 01:16, Walter Bright <newshound2 digitalmars.com> wrote:On 2/12/2014 4:24 PM, Iain Buclaw wrote:Will do ... in the morning.In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 12 2014
On Thursday, 13 February 2014 at 01:28:39 UTC, Iain Buclaw wrote:On 13 February 2014 01:16, Walter Bright <newshound2 digitalmars.com> wrote:See_also: http://d.puremagic.com/issues/show_bug.cgi?id=10233On 2/12/2014 4:24 PM, Iain Buclaw wrote:Will do ... in the morning.In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 12 2014
On 2/12/2014 5:37 PM, Brian Schott wrote:On Thursday, 13 February 2014 at 01:28:39 UTC, Iain Buclaw wrote:Thank you. It's important to make such a log of all such errors you find, otherwise the next poor soul will have to suffer through it all over again.On 13 February 2014 01:16, Walter Bright <newshound2 digitalmars.com> wrote:See_also: http://d.puremagic.com/issues/show_bug.cgi?id=10233On 2/12/2014 4:24 PM, Iain Buclaw wrote:Will do ... in the morning.In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 12 2014
On 13 February 2014 02:23, Walter Bright <newshound2 digitalmars.com> wrote:On 2/12/2014 5:37 PM, Brian Schott wrote:I checked over the already existing reports, and this is what I'm seeing: http://d.puremagic.com/issues/show_bug.cgi?id=10232On Thursday, 13 February 2014 at 01:28:39 UTC, Iain Buclaw wrote:Thank you. It's important to make such a log of all such errors you find, otherwise the next poor soul will have to suffer through it all over again.On 13 February 2014 01:16, Walter Bright <newshound2 digitalmars.com> wrote:See_also: http://d.puremagic.com/issues/show_bug.cgi?id=10233On 2/12/2014 4:24 PM, Iain Buclaw wrote:Will do ... in the morning.In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 13 2014
On Thursday, 13 February 2014 at 01:16:47 UTC, Walter Bright wrote:On 2/12/2014 4:24 PM, Iain Buclaw wrote:Use of my parser keeps finding places where my grammar is wrong. Here's an example from today: https://github.com/Hackerpilot/Dscanner/commit/54118e905f55239fb7c03c101db84b22e4368e51#diff-6331f8b31e134d0bacb245c850fe5404 This reminds me that I haven't synchronized the parser's doc comments with that ANTLR file in a while. Hopefully I'll have time for that on the weekend.In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)Should issue pull requests for errors found in the grammar!
Feb 12 2014
2014-02-13 9:24 GMT+09:00 Iain Buclaw <ibuclaw gdcproject.org>:On 13 February 2014 00:18, Iain Buclaw <ibuclaw gdcproject.org> wrote:In git head, 'Grammar' page is added. https://github.com/D-Programming-Language/dlang.org/blob/master/grammar.dd Kenji HaraOn 13 February 2014 00:06, Brian Schott <briancschott gmail.com> wrote:notOn Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:I'm just curious if anyone else has stumbled onto this, and whether orrules:Thanks! Having a look at D.g4, I'm seeing that you do the same with theit's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammarIn any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)
Feb 12 2014
On 13 February 2014 06:17, Kenji Hara <k.hara.pg gmail.com> wrote:2014-02-13 9:24 GMT+09:00 Iain Buclaw <ibuclaw gdcproject.org>:Bleh, that contains the same mistakes!On 13 February 2014 00:18, Iain Buclaw <ibuclaw gdcproject.org> wrote:In git head, 'Grammar' page is added. https://github.com/D-Programming-Language/dlang.org/blob/master/grammar.ddOn 13 February 2014 00:06, Brian Schott <briancschott gmail.com> wrote:In any case, everything looks lean enough that I'll probably believe your documented grammar more than the official dlang site. ;-)On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Thanks! Having a look at D.g4, I'm seeing that you do the same with the rules:I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 13 2014
On 2/13/2014 12:42 AM, Iain Buclaw wrote:On 13 February 2014 06:17, Kenji Hara <k.hara.pg gmail.com> wrote:It should, because it should contain exactly the same grammar as is distributed around the rest of the spec. The two should be corrected in sync, not independently.In git head, 'Grammar' page is added. https://github.com/D-Programming-Language/dlang.org/blob/master/grammar.ddBleh, that contains the same mistakes!
Feb 14 2014
On Thursday, 13 February 2014 at 00:06:11 UTC, Brian Schott wrote:On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Brian's ANTLR grammar file is one that matches closely current stat of affairs. I use it in two small Java apps. :)I'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 18 2014
Am Thu, 13 Feb 2014 00:06:10 +0000 schrieb "Brian Schott" <briancschott gmail.com>:On Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Is it a bad sign if I happen to remember the reference ? :p -- MarcoI'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 18 2014
On Tue, 18 Feb 2014 13:18:00 -0500, Marco Leise <Marco.Leise gmx.de> wrote:Am Thu, 13 Feb 2014 00:06:10 +0000 schrieb "Brian Schott" <briancschott gmail.com>:No, but it is bad if the "da da da DAAAAA" sound plays in your head while reading it :) -SteveOn Thursday, 13 February 2014 at 00:00:11 UTC, Iain Buclaw wrote:Is it a bad sign if I happen to remember the reference ? :pI'm just curious if anyone else has stumbled onto this, and whether or not it's just human error on my part. :o) Regards Iain.It's dangerous to go alone. Take this! https://github.com/Hackerpilot/DGrammar
Feb 18 2014
On 13.02.2014 01:00, Iain Buclaw wrote:This might be because the rules I have in place are not complete (I'm not implementing a complete D expression parser), but I have my doubts on this, and currently leaning on a possible problem in the documentation. I've built up rules in yacc based on what's documented here: http://dlang.org/expression.html However I seem to be getting shift/reduce conflicts around: AndAndExpression: OrExpression | AndAndExpression && OrExpression CmpExpression | AndAndExpression && CmpExpression ; OrExpression: XorExpression | OrExpression | XorExpression ; XorExpression: AndExpression | XorExpression ^ AndExpression ; AndExpression: ShiftExpression | AndExpression & ShiftExpression ; CmpExpression: ShiftExpression | EqualExpression | IdentityExpression | RelExpression ; CmpExpression: ShiftExpression | EqualExpression | IdentityExpression | RelExpression ;I think this is by design to disallow comparison operators and binary operators in the same expression without paranthesis: int x = a & b < c; op.d(2): Error: b < c must be parenthesized when next to operator & The grammar in the spec doesn't play nice with generators and isn't always correct, but in this case, I think it is.
Feb 14 2014
On 14 February 2014 19:40, Rainer Schuetze <r.sagitario gmx.de> wrote:I think this is by design to disallow comparison operators and binary operators in the same expression without paranthesis: int x = a & b < c;Yeah, I didn't buy that argument at first. Not least because it didn't look like the conflicts came from '&'op.d(2): Error: b < c must be parenthesized when next to operator & The grammar in the spec doesn't play nice with generators and isn't always correct, but in this case, I think it is.Enforced brackets could be what is missing here... --- AndAndExpression: ( OrExpression ) | AndAndExpression && ( OrExpression ) | CmpExpression | AndAndExpression && CmpExpression ; /* ... */ AndExpression: CmpExpression | AndExpression & ( CmpExpression ) ; --- Bison likes it... however that seems to have broken expression parsing in other ways. I assume this is because I haven't yet introduced brackets into the grammar yet. :o) Regards Iain.
Feb 15 2014
On 15 February 2014 20:09, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 14 February 2014 19:40, Rainer Schuetze <r.sagitario gmx.de> wrote:As soon as I introduced PrimaryExpression: ( Expression ) ; I just ended up reverting it back, so the expression parser happily accepts (a & b < c); as well as variants with multiple brackets inside. At the moment it's just good to get a D expression evaluator thats' actually working, then worry about was is invalid D later. :o) Regards Iain.I think this is by design to disallow comparison operators and binary operators in the same expression without paranthesis: int x = a & b < c;Yeah, I didn't buy that argument at first. Not least because it didn't look like the conflicts came from '&'
Feb 18 2014