apaz-cli / daisho Goto Github PK
View Code? Open in Web Editor NEWA high level programming language which compiles to C.
License: GNU General Public License v3.0
A high level programming language which compiles to C.
License: GNU General Public License v3.0
Using a modified peg/leg from here https://github.com/mingodad/peg to convert the grammar/Grammar.peg
in an EBNF understood by https://www.bottlecaps.de/rr/ui to generate a nice railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram) to help show/understand the syntax.
Command to generate before some minor manual fixes (basically comment out what is not accepted) peg -e syntax.peg
.
Copy and paste the EBNF shown bellow at https://www.bottlecaps.de/rr/ui on the tab Edit Grammar then click on the tab View Diagram.
//To be viewd at https://www.bottlecaps.de/rr/ui
CompilationUnit ::=
_ TopLevelDeclaration+ _ _NOT_ .
_ ::=
( WS | ML_COMMENT | SL_COMMENT )*
TopLevelDeclaration ::=
_
| GlobalVariableDeclaration
| FunctionDeclaration
| ClassDeclaration
| TraitDeclaration
| TraitImplementation
| CTypeDeclaration
| CFlagDeclaration
| ImportStatement
GlobalVariableDeclaration ::=
"A"
FunctionDeclaration ::=
"F"
ClassDeclaration ::=
"class" _ STypeIdent _ TraitConstraint? _ "{" _ ClassMember* _ "}" _ ";"?
TraitDeclaration ::=
"trait" SIdent ";"
TraitImplementation ::=
"impl" _ STypeIdent _ "for" _ STypeIdent _ "where"
CTypeDeclaration ::=
"ctype" _ CTypeIdent _ ";"
CFlagDeclaration ::=
"cflag" _ StringLiteral _ ";"
ImportStatement ::=
( "import" | "include" ) _ StringLiteral _ ";"
ClassMember ::=
_
TraitConstraint ::=
( "impl" _ STypeIdent _ WhereConstraint? )?
STypeIdent ::=
[_A-Z] [_a-zA-Z0-9]+
WhereConstraint ::=
( "where" _ STypeIdent _ "impl" _ TraitList )?
TraitList ::=
STypeIdent
SIdent ::=
( [_a-zA-Z] | GreekChar ) ( [_a-zA-Z0-9] | GreekChar )+
CTypeIdent ::=
[_a-zA-Z] [_a-zA-Z0-9]+ "*"*
StringLiteral ::=
SCharFrag+
CTBindDeclaration ::=
"tbind" _ ";"
CFBindDeclaration ::=
"fbind" _ ";"
Statement ::=
";"
| Expr
| BlockStatement
| IfStatement
| ElseStatement
| ForStatement
| WhileStatement
| ReturnStatement
Expr ::=
"expr"
BlockStatement ::=
"{" _ Statement* _ "}"
IfStatement ::=
"if"
ElseStatement ::=
"else"
ForStatement ::=
"for"
WhileStatement ::=
"while" _ "(" _ Expr _ "}" _
ReturnStatement ::=
_ ( "return" | "ret" ) _ Expr _ ";" _
GreekChar ::=
[αβγδεζηθικλμνξοπρσςτυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ]
SType ::=
STypeIdent STypePostfix+
STypePostfix ::=
"*"
| "[]"
| ( "<" SType ">" )
SCharFrag ::=
'"' SChar+ '"'
SChar ::=
[^"\\\r\n]
| EscapeSequence
EscapeSequence ::=
( "\\" ['"?abfnrtv\\] )
| ( "\\x" [0-9A-F]+ )
WS ::=
[ \t\r\n]+
ML_COMMENT ::=
"/*" .*? "*/"
SL_COMMENT ::=
"//" [^\n]*
//Added tokens for railroad generation
_NOT_ ::= '!'
_AND_ ::= '&'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.