View Issue Details

IDProjectCategoryView StatusLast Update
0001243Ecere SDKcompilerpublic2022-01-11 11:13
Reportermingodad Assigned Tojerome  
PrioritynormalSeverityminorReproducibilityhave not tried
Status confirmedResolutionopen 
Platform-crossplatformOS-OS Version-
Summary0001243: Missing grammar.y update after changing RESTRICT
DescriptionOn this commit https://github.com/ecere/ecere-sdk/commit/61090b7b04d88ff76c9f66eff72aeb063cebc262 it seems that it was forgotten to also update grammar.y till today, actually we have the references bellow on grammar.y but no mention for recognizing "RESTRICT" tokens on the lexer.

I found this while trying to generate railroad diagram for the grammar through https://www.bottlecaps.de/convert/ and https://www.bottlecaps.de/rr/ui .

====
storage_class_specifier
         ::= 'typedef'
           | 'extern'
           | 'static'
           | '__thread'
           | 'auto'
           | 'register'
           | RESTRICT
...
external_storage_class_specifier
         ::= 'typedef'
           | 'extern'
           | 'static'
           | '__thread'
           | 'auto'
           | 'register'
           | RESTRICT
...
====
Tagsgrammar

Activities

jerome

2022-01-10 02:25

administrator   ~0001499

@mingodad Thank you for reporting this. You might want to check out our latest (possibly somehwat outdated) railroad diagram at https://ec-lang.org/grammar/ as well.

mingodad

2022-01-10 10:45

developer   ~0001502

Thank you for the link !
Why not this link is on the home page ?
Where is the EBNF for it ?
Could you fix this issue and update the railroad diagram ?
Cheers !

mingodad

2022-01-10 17:21

developer   ~0001513

Isn't this number of conflicts a bit high ?
Bison says:
=====
grammar.y: warning: 3284 shift/reduce conflicts [-Wconflicts-sr]
grammar.y: warning: 1493 reduce/reduce conflicts [-Wconflicts-rr]

=====
ยท$ bison-nb --defines=grammar.h --locations --report=lookahead --verbose grammar.y -o grammar.ec
grammar.y:375.25: warning: stray '$' [-Wother]
  375 | Compiler_Error($"Not a type: %s\n", $1.string);
      | ^
grammar.y:1711.95: warning: stray '$' [-Wother]
 1711 | ...er_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc ...
      | ^
grammar.y:1712.96: warning: stray '$' [-Wother]
 1712 | ...er_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc ...
      | ^
grammar.y:3066.27: warning: stray '$' [-Wother]
 3066 | Compiler_Warning($"extra comma\n");
      | ^
grammar.y:3084.27: warning: stray '$' [-Wother]
 3084 | Compiler_Warning($"extra comma\n");
      | ^
grammar.y:3297.68: warning: stray '$' [-Wother]
 3297 | labeled_statement_error { $$ = $1; Compiler_Error($"...
      | ^
grammar.y:3298.63: warning: stray '$' [-Wother]
 3298 | | iteration_statement_error { $$ = $1; Compiler_Error($"synta...
      | ^
grammar.y:3299.63: warning: stray '$' [-Wother]
 3299 | | compound_statement_error { $$ = $1; Compiler_Error($"synta...
      | ^
grammar.y:3300.68: warning: stray '$' [-Wother]
 3300 | | selection_statement_error { $$ = $1; Compiler_Error($"...
      | ^
grammar.y:3301.63: warning: stray '$' [-Wother]
 3301 | | jump_statement_error { $$ = $1; Compiler_Error($"synta...
      | ^
grammar.y:3302.68: warning: stray '$' [-Wother]
 3302 | | jump_statement error { $$ = $1; Compiler_Error($"...
      | ^
grammar.y:3303.67: warning: stray '$' [-Wother]
 3303 | | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"s...
      | ^
grammar.y: warning: 3284 shift/reduce conflicts [-Wconflicts-sr]
grammar.y: warning: 1493 reduce/reduce conflicts [-Wconflicts-rr]
grammar.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples

mingodad

2022-01-11 11:13

developer   ~0001514

Also "compiler/libec/src/expression.y" and "compiler/libec/src/type.y" that seems to be a subset of "compiler/libec/src/grammar.y" are out of sync between then.

Issue History

Date Modified Username Field Change
2022-01-07 13:31 mingodad New Issue
2022-01-07 13:31 mingodad Tag Attached: grammar
2022-01-10 02:25 jerome Assigned To => jerome
2022-01-10 02:25 jerome Status new => confirmed
2022-01-10 02:25 jerome Note Added: 0001499
2022-01-10 10:45 mingodad Note Added: 0001502
2022-01-10 17:21 mingodad Note Added: 0001513
2022-01-11 11:13 mingodad Note Added: 0001514