Eagle Legacy Modernization, LLC

Rust Grammar

Main program: Rust_Program

Rust syntax:

 Count  Terminals:
  Rust_BinaryNumber: A binary number
  Rust_Character_Literal: Literal quotes:' escape:\ doubled:no multiline:no
  Rust_Comment: /* comment */ or // comment to end of line
  Rust_Function_Definition: An identifier
  Rust_HexNumber: A hex number
  Rust_Identifier_Reference: An identifier
  Rust_Literal: Literal quotes:" escape:\ doubled:no multiline:no
  Rust_Module_Definition: An identifier
  Rust_Number: Number exponent_chars:Ee suffix_chars:LlFfDd trailing_period:yes ignore_char:_
  Rust_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
    Rust_AdditiveExpression: Rust_Expression ("+"|"-") Rust_Expression
    Rust_AsExpression: Rust_Expression "as" Rust_TypeExpression
    Rust_AssignmentExpression: Rust_Expression ("="|"+="|"-=") Rust_Expression
    Rust_BitwiseExpression: Rust_Expression ("&"|"|"|"^") Rust_Expression
    Rust_BorrowExpression: '&' Rust_Expression
    Rust_BuiltIn: ("false"|"true")
    Rust_CastExpression: ("i32"|"f64") "::" "from" '(' Rust_Expression ')'
    Rust_ClassCreationExpression: "new" Rust_Type '(' [Rust_Comment]* [Rust_Expression]* ')'
    Rust_ExpressionArray: '&' '[' Rust_Expression* ']'
    Rust_LogicalAndExpression: Rust_Expression "&&" Rust_Expression
    Rust_LogicalOrExpression: Rust_Expression ("||"|"^") Rust_Expression
    Rust_MethodInvocation: Rust_MethodWhat ['!'] '(' [Rust_Expression]* ')'
    |   Rust_MethodClass: Rust_Identifier_Reference "::" Rust_Variable
    |   Rust_MethodWhat: (Rust_MethodClass | Rust_Variable)
    Rust_MultiplicativeExpression: Rust_Expression ("*"|"/"|"%") Rust_Expression
    Rust_NegativeExpression: '-' Rust_Expression
    Rust_NotExpression: '!' Rust_Expression
    Rust_ParenthesizedExpression: '(' Rust_Expression* ')'
    Rust_RangeExpression: Rust_Expression (".."|"..=") [Rust_Expression]
    Rust_RelationalExpression: Rust_Expression ("=="|"!="|"<"|">"|"<="|">=") Rust_Expression
    Rust_ShiftExpression: Rust_Expression (">>>"|"<<"|">>") Rust_Expression
    Rust_Subfield: Rust_Expression '.' Rust_Expression
    Rust_SubscriptExpression: Rust_Expression '[' Rust_Expression ']'
    Rust_TypeExpression: Rust_Type
    Rust_VariableExpression: Rust_Variable
    Rust_AbsMethod: Rust_Expression '.' "abs" '(' ')'
    Rust_FindMethod: Rust_Variable '.' "find" '(' Rust_Expression ')'
    Rust_FormatFunction: "format" '!' '(' Rust_Expression* ')'
    Rust_LenMethod: Rust_Expression '.' "len" '(' ')'
    Rust_PowMethod: Rust_Expression '.' ("pow"|"powf") '(' Rust_Expression ')'
    Rust_PrintlnFunction: ("print"|"println") '!' '(' Rust_Expression* ')' [';']
    Rust_RevMethod: Rust_Expression '.' "rev" '(' ')'
    Rust_StartsWithMethod: Rust_Expression '.' "starts_with" '(' Rust_Expression ')'
    Rust_ToStringMethod: Rust_Expression '.' ("as_str"|"to_string") '(' ')'
    Rust_TrimMethod: Rust_Expression '.' "trim" '(' ')'
    Rust_Expression: (Rust_BinaryNumber | Rust_HexNumber | Rust_Number | Rust_Literal | Rust_Character_Literal | Rust_Underscore | Rust_MethodInvocation | Rust_NegativeExpression | Rust_NotExpression | Rust_BuiltIn | Rust_VariableExpression | Rust_CastExpression | Rust_FormatFunction | Rust_ParenthesizedExpression | Rust_ExpressionArray | Rust_BorrowExpression | Rust_PrintlnFunction | Rust_TypeExpression | Rust_ClassCreationExpression | Rust_FindMethod | Rust_AbsMethod | Rust_SubscriptExpression | Rust_LenMethod | Rust_PowMethod | Rust_RevMethod | Rust_StartsWithMethod | Rust_ToStringMethod | Rust_TrimMethod | Rust_Subfield | Rust_MultiplicativeExpression | Rust_AdditiveExpression | Rust_ShiftExpression | Rust_RelationalExpression | Rust_BitwiseExpression | Rust_LogicalAndExpression | Rust_LogicalOrExpression | Rust_RangeExpression | Rust_AsExpression | Rust_AssignmentExpression)
    Rust_Function: ["pub"] "fn" Rust_Function_Definition '(' [Rust_Parameter]* ')' [Rust_FunctionReturns] Rust_Block_Statement
    |   Rust_FunctionReturns: "->" Rust_Type
    |   Rust_Parameter: Rust_Variable_Definition ':' Rust_Type
    Rust_Module: ["pub"] "mod" Rust_Module_Definition Rust_Module_Body
    |   Rust_Module_Body: (';' | Rust_Block_Statement)
    Rust_Program: Rust_TopElement*
    |   Rust_TopElement: (Rust_Comment | Rust_Function | Rust_Module | Rust_Use | Rust_Statement)
    Rust_Statement: (Rust_Comment | Rust_Block_Statement | Rust_ConstStatement | Rust_BreakStatement | Rust_ExitStatement | Rust_IfStatement | Rust_ForStatement | Rust_LetStatement | Rust_MatchStatement | Rust_ReturnStatement | Rust_Use | Rust_WhileStatement | Rust_FunctionCall | Rust_ExpressionStatement)
    Rust_Type: (Rust_TypeArray | Rust_TypePrimitive)
    |   Rust_TypeArray: '&' ''' "static" '[' Rust_Type ']'
    |   Rust_TypePrimitive: [Rust_TypePrimitiveStatic] ("bool"|"f64"|"isize"|"i32"|"str"|"&str"|"String"|"usize"|"u32"|"HashMap")
    |   |   Rust_TypePrimitiveStatic: '&' ''' "static"
    Rust_Use: ["pub"] "use" Rust_Identifier_Reference* ';'
    Rust_Variable: Rust_Identifier_Reference
    Rust_Block_Statement: '{' Rust_Statement* '}'
    Rust_BreakStatement: "break" [';']
    Rust_ConstStatement: ["pub"] ("const"|"static") Rust_Variable_Definition ':' Rust_Type [Rust_Data_Initial] ';'
    |   Rust_Data_Initial: '=' Rust_Expression
    Rust_ExitStatement: "process" "::" "exit" '(' Rust_Expression ')' [';']
    Rust_ExpressionStatement: Rust_Expression [';']
    Rust_ForStatement: "for" Rust_Variable "in" Rust_Expression Rust_Statement
    Rust_FunctionCall: Rust_MethodInvocation [';']
    Rust_IfStatement: "if" Rust_Expression Rust_Statement [Rust_IfElseClause]
    |   Rust_IfElseClause: "else" Rust_Statement
    Rust_LetStatement: "let" ["mut"] Rust_Variable [Rust_ColonType] [Rust_DataInitialize] [';']
    |   Rust_ColonType: ':' Rust_Type
    |   Rust_DataInitialize: '=' Rust_Expression
    Rust_MatchStatement: "match" Rust_Expression '{' Rust_MatchClause* '}'
    |   Rust_CaseClause: Rust_Expression* "=>" [Rust_Statement]* [',']
    |   Rust_DefaultClause: '_' "=>" [Rust_Statement]* [',']
    |   Rust_MatchClause: (Rust_Comment | Rust_CaseClause | Rust_DefaultClause)
    Rust_ReturnStatement: "return" Rust_Expression [';']
    Rust_WhileStatement: "while" Rust_Expression [Rust_Comment] Rust_Statement

Terminals = 10 (instances=0)
Tokens = 69 (instances=0)

(*) Statistics are shown in the same order as the Tokens.
Percentages are rounded; 'all' and 'none' mean 100% and 0% before rounding.
For lists, it shows the average number of occurrences, excluding empty lists.