Closed mingodad closed 5 months ago
I let the doc/rune_reference.md file get out of date, so I regenerated the BNF like you did, and ran it through the web sites you linked to. I'll push the new docs today to github. The BNF now is able to be used to generate the railroad diagrams.
It seems that it got a bit messed up here https://github.com/google/rune/blob/main/doc/rune_reference.md#grammar , see //!!!!
marks bellow:
statements ::= | statements statement statement ::= appendCode | assertStatement //!!!! here seems to be missing a newline
| assignmentStatement | callStatement | class | debugStatement | enum | externFunction | finalFunction
| foreachStatement | forStatement | function | generateStatement | generatorStatement | ifStatement
| import | prependCode | printlnStatement | printStatement | refStatement | relationStatement
| returnStatement | struct | switchStatement | throwStatement | unitTestStatement | unrefStatement
| whileStatement | yield
accessExpression ::= tokenExpression
| accessExpression '(' callParameterList ')'
| accessExpression '.' IDENT
| accessExpression '[' expression ']'
| accessExpression '[' expression ' ::= ' expression ']' //!!!! here should be ':' instead of ' ::= '
selectExpression ::= orExpression
| orExpression '?' orExpression ' ::= ' orExpression //!!!! here should be ':' instead of ' ::= '
I've just added https://mingodad.github.io/parsertl-playground/playground/ an Yacc/Lex
compatible online editor/tester (select Rune parser
from Examples
then click Parse
to see a parser tree for the content in Input source
editor).
I hope it can help debug/develop/test/document this project grammar !
Any feedback is welcome !
I'm getting the error shown bellow when trying to run the hello.rn
as shown in the readme.
./rune -g hello.rn
hello.ll:9:45: error: expected ')' at end of argument list
declare i32 @_setjmp(%struct.__jmp_buf_tag* noundef)
^
1 error generated.
The problem mentioned above was that I have clang-6 as default installed but rune
is built with clang-15 and was not checking that it's executing the correct version of clang/llvm, maybe would be nice to check/save the clang/llvm version/location.
Using some online tools like https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ and a bit of manual fixes we can have a nice navigable railroad diagram.
Copy and paste the
EBNF
shown bellow on https://www.bottlecaps.de/rr/ui on the tabEdit Grammar
the click on the tabView Diagram
to see/download a navigable railroad diagram.