You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This grammar deviates a bit from the code flow on CiParser.cs but I think is good enough to give a global overview of Cito grammar
actually it recognizes almost all of test/*.ci:
C[2][3][n*2]a;// three-dimensional array storage local variablea[2][3][i*2]=5;// array element assignment
The number of array dimensions isn't limited by the language. Also, the expressions in brackets can be arbitrarily long.
If the brackets are followed by an identifier, it's a definition. Otherwise, it's an expression. I think that makes it LL(*).
CiParser.cs is a recursive-descent LL(1) parser. It handles the above case by outputting a temporary form for the variable definitions: the type is specified as an expression that is translated into proper type in CiResolver.ToType. That means that CiParser doesn't catch all the syntax errors, for example:
After going through the
CiParser.cs
and writing anLL(1)
grammar with a modified https://github.com/mingodad/CocoR-CSharp I've got it to generate an EBNF understood by https://www.bottlecaps.de/rr/ui to generate railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram).Copy the EBNF shown bellow and paste on https://www.bottlecaps.de/rr/ui in the tab
Edit Grammar
then switch to the tabView Diagram
:This grammar deviates a bit from the code flow on
CiParser.cs
but I think is good enough to give a global overview ofCito grammar
actually it recognizes almost all of
test/*.ci
:The text was updated successfully, but these errors were encountered: