Eagle Legacy Modernization, LLC

Go Grammar

Main program: Go_Program

Go syntax:

 Count  Terminals:
  Go_Comment: // comment to end of line
  Go_EOLN: End of line
  Go_Field_Definition: An identifier
  Go_Function_Definition: An identifier
  Go_Identifier: An identifier
  Go_Identifier_Reference: An identifier
  Go_Literal: Literal quotes:`" escape:\ doubled:no multiline:yes
  Go_Number: Number exponent_chars:Ee suffix_chars:LlFfDd trailing_period:yes ignore_char:none
  Go_Type_Definition: An identifier
  Go_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
    Go_AdditiveExpression: Go_Expression ("+"|"-") Go_Expression
    Go_AmpersandExpression: '&' Go_Expression
    Go_AssignmentExpression: Go_Expression ("="|":="|"*="|"/="|"%="|"+="|"-=") Go_Expression
    Go_BracesExpression: '{' Go_Expression* '}'
    Go_BuiltIn: ("false"|"true")
    Go_Constructor: Go_Variable '{' [Go_ConstructField]* '}'
    |   Go_ConstructField: Go_Field_Definition ':' Go_Expression
    Go_EmptyArrayExpression: '[' ']' Go_Expression
    Go_EqualityExpression: Go_Expression ("=="|"!=") Go_Expression
    Go_FunctionCall: Go_Variable '(' [Go_Expression]* ')'
    Go_LogicalAndExpression: Go_Expression "&&" Go_Expression
    Go_LogicalNotExpression: ("!"|"~") Go_Expression
    Go_LogicalOrExpression: Go_Expression "||" Go_Expression
    Go_MultiplicativeExpression: Go_Expression ("*"|"/"|"%") Go_Expression
    Go_NegativeExpression: ("-") Go_Expression
    Go_ParenthesizedExpression: '(' Go_Expression ')'
    Go_PostIncrementExpression: Go_Variable ("++"|"--")
    Go_PreIncrementExpression: ("++"|"--") Go_Variable
    Go_RelationalExpression: Go_Expression ("<"|">"|"<="|">=") Go_Expression
    Go_StarExpression: '*' Go_Expression
    Go_SubscriptExpression: Go_Expression '[' [Go_Expression] [':'] [Go_Expression] ']'
    Go_VariableExpression: Go_Variable
    Go_LenFunction: "len" '(' Go_Expression ')'
    Go_CommentEoln: Go_Comment Go_EOLN
    Go_Expression: (Go_Number | Go_Literal | Go_LenFunction | Go_FunctionCall | Go_PreIncrementExpression | Go_PostIncrementExpression | Go_NegativeExpression | Go_LogicalNotExpression | Go_BuiltIn | Go_VariableExpression | Go_Constructor | Go_BracesExpression | Go_ParenthesizedExpression | Go_EmptyArrayExpression | Go_StarExpression | Go_AmpersandExpression | Go_SubscriptExpression | Go_MultiplicativeExpression | Go_AdditiveExpression | Go_RelationalExpression | Go_EqualityExpression | Go_LogicalAndExpression | Go_LogicalOrExpression | Go_AssignmentExpression)
    Go_Program: Go_Element*
    |   Go_Element: (Go_CommentEoln | Go_Package | Go_Import | Go_Data | Go_Function | Go_Statement)
    Go_Statement: (Go_BlockStatement | Go_BreakStatement | Go_CommentEoln | Go_ConstBlock | Go_FmtPrintfStatement | Go_ForStatement | Go_IfStatement | Go_ReturnStatement | Go_SwitchStatement | Go_TypeDefinition | Go_VarStatement | Go_WhileStatement | Go_ExpressionStatement)
    Go_Type: [Go_TypeArray] ['*'] Go_TypeWhat
    |   Go_TypeArray: '[' ']'
    |   Go_TypeWhat: (Go_UserType | ("bool"|"int"|"string"))
    |   |   Go_UserType: Go_Identifier_Reference*
    Go_Variable: Go_Identifier_Reference* [Go_Subscript]
    |   Go_Subscript: '[' Go_Expression ']'
    Go_BlockStatement: '{' Go_EOLN Go_Statement* '}' [Go_EOLN]
    Go_BreakStatement: "break" Go_EOLN
    Go_ConstBlock: "const" '(' Go_EOLN Go_ConstAssignment* ')' Go_EOLN
    |   Go_ConstAssignment: Go_Variable* ("="|"+="|"-="|"*="|"/="|":=") Go_Expression Go_EOLN
    Go_Data: "var" Go_Variable_Definition '=' Go_Type Go_Expression Go_EOLN
    Go_ExpressionStatement: Go_Expression [Go_Comment] Go_EOLN
    Go_FmtPrintfStatement: "fmt" '.' ("Printf"|"Println") '(' Go_Expression* ')' Go_EOLN
    Go_ForStatement: "for" Go_Identifier_Reference ":=" Go_ForWhat
    |   Go_ForLoop: Go_Expression ';' Go_Expression ';' Go_Expression Go_Statement
    |   Go_ForRange: "range" Go_Variable Go_Statement
    |   Go_ForWhat: (Go_ForLoop | Go_ForRange)
    Go_Function: "func" Go_Function_Definition '(' [Go_FunctionParameter]* ')' [Go_FuncReturnType] Go_Statement
    |   Go_FuncReturnType: (Go_FuncReturnMulti | Go_Type)
    |   |   Go_FuncReturnMulti: '(' Go_Type* ')'
    |   Go_FunctionParameter: Go_Variable_Definition ['*'] Go_Type
    Go_IfStatement: "if" Go_Expression Go_Statement [Go_IfElseClause]
    |   Go_IfElseClause: "else" Go_Statement
    Go_Import: "import" Go_ImportWhat Go_EOLN
    |   Go_ImportWhat: (Go_ImportList | Go_Literal)
    |   |   Go_ImportList: '(' Go_EOLN Go_ImportLine* ')'
    |   |   |   Go_ImportLine: [Go_Variable_Definition] Go_Literal Go_EOLN
    Go_Package: "package" Go_Identifier Go_EOLN
    Go_ReturnStatement: "return" Go_Expression Go_EOLN
    Go_SwitchStatement: "switch" Go_Variable '{' Go_EOLN Go_SwitchCase* '}' Go_EOLN
    |   Go_SwitchCase: "case" Go_Expression ':' Go_EOLN Go_Statement*
    Go_TypeDefinition: "type" Go_Type_Definition "struct" '{' Go_EOLN Go_StructLine* '}' Go_EOLN
    |   Go_StructLine: Go_Variable_Definition Go_Type Go_EOLN
    Go_VarStatement: "var" Go_Variable_Definition Go_Type Go_EOLN
    Go_WhileStatement: "for" Go_Expression Go_Statement

Terminals = 10 (instances=0)
Tokens = 63 (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.