Talk:Compiler/Verifying syntax: Difference between revisions
Line 21: | Line 21: | ||
should not be legal (i.e. a non-associative violation). |
should not be legal (i.e. a non-associative violation). |
||
[] means 0 or 1. |
[] means 0 or 1. |
||
{} means 0 or more. [[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22: |
{} means 0 or more. --[[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22:28, 5 January 2020 (UTC) |
||
:Well spotted. Please sign your posts, with <nowiki>--~~~~</nowiki> thanks --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:14, 4 January 2020 (UTC) |
:Well spotted. Please sign your posts, with <nowiki>--~~~~</nowiki> thanks --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:14, 4 January 2020 (UTC) |
||
:: I didn't know how to sign :( [[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22: |
:: I didn't know how to sign :( --[[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22:28, 5 January 2020 (UTC) |
||
This problem is in dire need of a really extensive test suite. [[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22: |
This problem is in dire need of a really extensive test suite. --[[User:Tybalt89|Tybalt89]] ([[User talk:Tybalt89|talk]]) 22:28, 5 January 2020 (UTC) |
||
:That should be part of the task spec. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:14, 4 January 2020 (UTC) |
:That should be part of the task spec. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:14, 4 January 2020 (UTC) |
Revision as of 22:28, 5 January 2020
Incorrect BNF
The BNF given does not permit = to be directly followed by not. Go/Julia/Perl all get that wrong (better to fix task tho?).
The Go output also claims that "g not = h" is valid, whereas Perl/Julia and now Phix call that invalid. --Pete Lomax (talk) 18:57, 3 January 2020 (UTC)
I may not understand the specification given for BNF syntax. Doesn't the rule:
expr_level_4 = ["not"] expr_level_5 [('=' | '<') expr_level_5] ;
mean any expr_level_5 expression can be preceded by not? --Wherrera (talk) 19:09, 3 January 2020 (UTC)
- First/left one yes, second/right one no. Consider expr_level_4 = ["not"] expr_level_5 [('=' | '<') ["not"] expr_level_5] ;
- Ideally the not would be moved into its own private rule, rather than clog up the (partial) comparison rule anyway. --Pete Lomax (talk) 19:31, 3 January 2020 (UTC)
- Presumably the "not" applies to the relation as a whole, so "not a = b" means "not ( a = b )" and not "( not a ) = b". --Tigerofdarkness (talk) 22:01, 5 January 2020 (UTC)
Note the square brackets [] around the [('=' | '<') expr_level_5]. This means that the expression
'2 < 3 < 4'
should not be legal (i.e. a non-associative violation). [] means 0 or 1. {} means 0 or more. --Tybalt89 (talk) 22:28, 5 January 2020 (UTC)
- Well spotted. Please sign your posts, with --~~~~ thanks --Pete Lomax (talk) 14:14, 4 January 2020 (UTC)
This problem is in dire need of a really extensive test suite. --Tybalt89 (talk) 22:28, 5 January 2020 (UTC)
- That should be part of the task spec. --Pete Lomax (talk) 14:14, 4 January 2020 (UTC)