Eagle Legacy Modernization, LLC

RPG Grammar

Main programs: RPG_III_Program RPG_IV_Program RPGFree_Program

RPG syntax:

RPG syntax:

RPGFree syntax:

 Count  Terminals:
  RPGFree_Comment: /* comment */
  RPGFree_Identifier_Reference: An identifier
  RPGFree_Literal: quotes:' escape:none doubled:yes multiline:no
  RPGFree_Number: exponent_chars:Ee suffix_chars:none trailing_period:yes ignore_char:none
  RPGFree_Variable_Definition: An identifier
274 RPG_Blanks: RPG blanks
237 RPG_Comment: * comment
673 RPG_EndOfLine: End of line
4,335 RPG_Literal: RPG literal
374 RPG_Number: Number
 Count  Statistics(*) Tokens:
    RPG_Copy_Directive: "/COPY" RPG_Literal
    RPG_Eject_Directive: "/EJECT"
    RPG_Space_Directive: "/SPACE" RPG_Number
    RPG_Title_Directive: "/TITLE" RPG_Literal
    RPG_CTDATA: "** CTDATA" RPG_Literal RPG_EndOfLine RPG_CTDATA_item*
    |   RPG_CTDATA_item: RPG_Number RPG_EndOfLine
    |   RPG_CommentEOLN: RPG_Comment RPG_EndOfLine
1 63.00 none none |   RPG_III_Program: RPG_Item* [RPG_CTDATA]* [RPG_CommentEOLN]*
3 203.33 none none |   RPG_IV_Program: RPG_Item* [RPG_CTDATA]* [RPG_CommentEOLN]*
673 all all |   RPG_Item: [RPG_Spec_or_Directive] RPG_EndOfLine
673 (35% | none | none | none | none | none | none | none | none | none | none | 1% | none | none) |   RPG_Spec_or_Directive: (RPG_Comment | RPG_Title_Directive | RPG_Eject_Directive | RPG_Space_Directive | RPG_Copy_Directive | RPG_D_Data_Specification | RPG_U_AutoReport_Specification | RPG_H_Header_Specification | RPG_F_File_Specification | RPG_E_Extension_Specification | RPG_L_LineCounter_Specification | RPG_I_Input_Specification | RPG_C_Calculation_Specification | RPG_O_Output_Specification)
3 all all all all all all all all all all all all all all all all all all all |   RPG_C_Calculation_Specification_III: "C" [RPG_Literal] ["N"] [RPG_Literal] ["N"] [RPG_Literal] ["N"] [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] [("H"|"N"|"P"|"R")] [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal]
    |   RPG_D_Data_Specification_III: " D" [RPG_Literal] [""] [RPG_KeywordChoice] [RPG_KeywordChoice] [RPG_Number] [RPG_Number] [RPG_KeywordChoice] [RPG_Number] RPG_Blanks [RPG_Literal]
    RPG_E_Extension_Specification: "E" RPG_Blanks [RPG_Literal] [RPG_Literal] RPG_Literal RPG_Number RPG_Number [("P"|"B"|"L"|"R")] [RPG_Number] [("A"|"D")] RPG_Literal RPG_Number [("P"|"B"|"L"|"R")] [RPG_Number] [("A"|"D")] [RPG_Literal]
2 all all all all all all all all all all all all all all all all all all all all all all all all all |   RPG_F_File_Specification_III: "F" [RPG_Literal] [("I"|"O"|"U"|"C")] [("P"|"S"|"R"|"T"|"F")] ["E"] [("A"|"D")] [("F"|"E")] RPG_Blanks [RPG_Number] ["L"] [RPG_Number] [("A"|"P"|"K")] [("I"|"T")] [RPG_Literal] [RPG_Number] [("E"|"L")] [("PRINTER"|"DISK"|"WORKSTN"|"SPECIAL"|"SEQ")] RPG_Blanks ["K"] [RPG_Literal] RPG_Blanks ["A"] RPG_Blanks [RPG_Literal] RPG_Blanks
    |   RPG_H_Header_Specification_III: "H" ["1"] [RPG_Literal] [("M"|"D"|"Y")] [RPG_Literal] [("I"|"J"|"D")] ["S"] ["1"] ["F"] ["1"] [RPG_Literal]
9 (none | 11% | 67% | none | none | none | 11% | 11%) RPG_I_Input_Specification: (RPG_I_Input_Constant_Continued | RPG_I_Input_Data_Structure | RPG_I_Input_Data_Subfield | RPG_I_Input_External_Field_Descr | RPG_I_Input_External_Record_Id | RPG_I_Input_Named_Constant | RPG_I_Input_Program_Field_Descr | RPG_I_Input_Program_Record_Id)
    |   RPG_I_Input_Constant_Continued: "I" RPG_Blanks RPG_Literal RPG_Blanks
1 all all all all all all all all all all all |   RPG_I_Input_Data_Structure: "I" RPG_Literal RPG_Blanks ["E"] [("I"|"S"|"U")] ["DS"] RPG_Literal RPG_Blanks [RPG_Number] [RPG_Number] RPG_Blanks
6 all all all all all all all all |   RPG_I_Input_Data_Subfield: "I" RPG_Blanks RPG_I_Input_Data_Subfield_Init [("P"|"B")] RPG_I_Input_Data_Subfield_Position [RPG_Number] RPG_Literal RPG_Blanks
6 (all | none) |   |   RPG_I_Input_Data_Subfield_Init: (RPG_I_Input_Data_Subfield_Init1 | RPG_I_Input_Data_Subfield_Init2)
6 all all all |   |   |   RPG_I_Input_Data_Subfield_Init1: ["I"] RPG_Blanks RPG_Literal
    |   |   |   RPG_I_Input_Data_Subfield_Init2: RPG_Blanks RPG_Literal RPG_Blanks
6 (all | none) |   |   RPG_I_Input_Data_Subfield_Position: (RPG_I_Input_Data_Subfield_Position1 | RPG_I_Input_Data_Subfield_Position2)
6 all all |   |   |   RPG_I_Input_Data_Subfield_Position1: RPG_Number RPG_Number
    |   |   |   RPG_I_Input_Data_Subfield_Position2: ("*STATUS"|"*PROGRAM"|"*PARMS"|"*ROUTINE"|"*FILE"|"*RECORD"|"*OPCODE"|"*STATUS")
    |   RPG_I_Input_External_Field_Descr: "I" RPG_Blanks RPG_Literal RPG_Blanks RPG_Literal [RPG_Literal] [RPG_Literal] RPG_Blanks [RPG_Literal] RPG_Blanks
    |   RPG_I_Input_External_Record_Id: "I" RPG_Literal RPG_Blanks [RPG_Literal] RPG_Blanks RPG_Blanks
    |   RPG_I_Input_Named_Constant: "I" RPG_Blanks RPG_Literal ["C"] RPG_Blanks RPG_Literal RPG_Blanks
1 all all all all all all all all all all all all |   RPG_I_Input_Program_Field_Descr: "I" RPG_Blanks [("P"|"B"|"L"|"R")] RPG_Number RPG_Number [RPG_Number] RPG_Literal [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] RPG_Blanks
1 all all all all all all all all all all all all all all all all all all |   RPG_I_Input_Program_Record_Id: "I" RPG_I_Input_Program_Record_Id_Piece [("1"|"N")] ["O"] RPG_Literal [RPG_Number] ["N"] [("C"|"Z"|"D")] [RPG_Literal] [RPG_Number] ["N"] [("C"|"Z"|"D")] [RPG_Literal] [RPG_Number] ["N"] [("C"|"Z"|"D")] [RPG_Literal] RPG_Blanks
1 (all | none) |   |   RPG_I_Input_Program_Record_Id_Piece: (RPG_I_Input_Program_Record_Id_Piece1 | RPG_I_Input_Program_Record_Id_Piece2)
1 all all |   |   |   RPG_I_Input_Program_Record_Id_Piece1: RPG_Literal RPG_Literal
    |   |   |   RPG_I_Input_Program_Record_Id_Piece2: RPG_Blanks ("AND"|"OR")
    RPG_L_LineCounter_Specification: "L" RPG_Literal RPG_Number ["FL"] RPG_Number ["OL"] RPG_Blanks
42 all RPG_O_Output_Specification_III: RPG_O_Output_Spec
    |   RPG_O_Output_External_Field_Descr_III: "O" RPG_Blanks [RPG_Literal] RPG_Literal RPG_Blanks ["B"] RPG_Blanks
    |   RPG_O_Output_External_Record_Id_III: "O" RPG_Literal RPG_O_Output_External_Record_Id_Piece [RPG_Literal] [RPG_Literal] RPG_Blanks
    |   RPG_O_Output_External_Record_Id_Piece1_III: RPG_Literal ("H"|"D"|"T"|"E") "R" RPG_Blanks
    |   RPG_O_Output_External_Record_Id_Piece2_III: RPG_Blanks ("AND"|"OR") RPG_Blanks
    |   RPG_O_Output_External_Record_Id_Piece3_III: RPG_Blanks ("ADD"|"DEL") RPG_Blanks
    |   RPG_O_Output_External_Record_Id_Piece_III: (RPG_O_Output_External_Record_Id_Piece1 | RPG_O_Output_External_Record_Id_Piece2 | RPG_O_Output_External_Record_Id_Piece3)
28 all all all all all all all all all all |   RPG_O_Output_Program_Field_Descr_III: "O" RPG_Blanks [RPG_Literal] RPG_Literal [RPG_Literal] ["B"] [RPG_Literal] [("P"|"B"|"L"|"R")] [RPG_Literal] RPG_Blanks
14 all all all all all all all |   RPG_O_Output_Program_Record_Id_III: "O" RPG_O_Output_Program_Record_Id_Piece [RPG_Literal] [RPG_Literal] [RPG_Literal] [RPG_Literal] RPG_Blanks
9 all all all all all all all |   RPG_O_Output_Program_Record_Id_Piece1_III: RPG_Literal ("H"|"D"|"T"|"E") [("F"|"R")] [RPG_Number] [RPG_Number] [RPG_Literal] [RPG_Literal]
5 all all all |   RPG_O_Output_Program_Record_Id_Piece2_III: RPG_Blanks ("AND"|"OR") RPG_Blanks
    |   RPG_O_Output_Program_Record_Id_Piece3_III: RPG_Blanks ("ADD"|"DEL") RPG_Blanks
14 (none | none | none) |   RPG_O_Output_Program_Record_Id_Piece_III: (RPG_O_Output_Program_Record_Id_Piece1 | RPG_O_Output_Program_Record_Id_Piece2 | RPG_O_Output_Program_Record_Id_Piece3)
42 (none | none | none | none) |   RPG_O_Output_Spec_III: (RPG_O_Output_Program_Record_Id | RPG_O_Output_Program_Field_Descr | RPG_O_Output_External_Record_Id | RPG_O_Output_External_Field_Descr)
    RPG_U_AutoReport_Specification: "U"
    RPGFree_Additive: RPGFree_Expression ("+"|"-") RPGFree_Expression
    RPGFree_Multiplicative: RPGFree_Expression ("*"|"/") RPGFree_Expression
    RPGFree_Parentheses: '(' RPGFree_Expression ')'
    RPGFree_VariableExpression: ['*'] RPGFree_Identifier_Reference
    RPGFree_CharFunction: '%' "char" '(' RPGFree_Expression ')'
    RPGFree_Expression: (RPGFree_Number | RPGFree_Literal | RPGFree_CharFunction | RPGFree_VariableExpression | RPGFree_Parentheses | RPGFree_Multiplicative | RPGFree_Additive)
    RPGFree_Program: RPGFree_Free RPGFree_Item*
    |   RPGFree_Free: "**FREE"
    |   RPGFree_Item: (RPGFree_Comment | RPGFree_Control | RPGFree_Declare | RPGFree_Assignment | RPGFree_Display | RPGFree_Return)
    RPGFree_Type: (RPGFree_TypePacked)
    |   RPGFree_TypePacked: "packed" '(' RPGFree_Number ':' RPGFree_Number ')'
    RPGFree_Assignment: ['*'] RPGFree_Identifier_Reference '=' RPGFree_Expression ';'
    RPGFree_Control: "ctl-opt" RPGFree_ControlOption* ';'
    |   RPGFree_ControlOption: (RPGFree_ControlAct | RPGFree_ControlDft)
    |   |   RPGFree_ControlAct: "actgrp" '(' '*' "caller" ')'
    |   |   RPGFree_ControlDft: "dftactgrp" '(' '*' "no" ')'
    RPGFree_Declare: "dcl-s" RPGFree_Variable_Definition RPGFree_Type ';'
    RPGFree_Display: "dsply" '(' RPGFree_Expression ')' ';'
    RPGFree_Return: "return" ';'

Terminals = 10 (instances=5,893)
Tokens = 69 (instances=1,553)

(*) 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.