Eric Streit před 1 měsícem
rodič
revize
ba61edad30
20 změnil soubory, kde provedl 25 přidání a 435 odebrání
  1. 25 0
      .gitignore
  2. binární
      CR
  3. binární
      CRA.o
  4. binární
      CRC.o
  5. binární
      CRG.o
  6. binární
      CRP.o
  7. binární
      CRS.o
  8. binární
      CRT.o
  9. binární
      CRX.o
  10. binární
      FileIO.o
  11. binární
      Sets.o
  12. binární
      Test/FileIO.o
  13. binární
      Test/Pascal
  14. 0 81
      Test/Pascal.err
  15. binární
      Test/PascalP.o
  16. binární
      Test/PascalS.o
  17. 0 9
      Test/gen.log
  18. 0 65
      Test/modules.lst
  19. 0 280
      Test/pascal.lst
  20. 0 0
      Test/uselist.log

+ 25 - 0
.gitignore

@@ -0,0 +1,25 @@
+# --- GNU Modula-2 build artifacts ---
+*.o
+*.obj
+*.so
+*.a
+*.gch
+
+# --- Coco/R generated files ---
+*.err
+*.bit
+states.bin
+
+# --- Executables (project binaries) ---
+CR
+Pascal
+
+# --- Compiler/run logs ---
+*.log
+*.lst
+modules.lst
+
+# --- Editor/OS droppings ---
+*~
+*.swp
+.DS_Store

binární
CR


binární
CRA.o


binární
CRC.o


binární
CRG.o


binární
CRP.o


binární
CRS.o


binární
CRT.o


binární
CRX.o


binární
FileIO.o


binární
Sets.o


binární
Test/FileIO.o


binární
Test/Pascal


+ 0 - 81
Test/Pascal.err

@@ -1,81 +0,0 @@
-   0: Msg("EOF expected")
-|  1: Msg("identifier expected")
-|  2: Msg("integer expected")
-|  3: Msg("real expected")
-|  4: Msg("string expected")
-|  5: Msg("'PROGRAM' expected")
-|  6: Msg("';' expected")
-|  7: Msg("'.' expected")
-|  8: Msg("'(' expected")
-|  9: Msg("')' expected")
-| 10: Msg("'LABEL' expected")
-| 11: Msg("',' expected")
-| 12: Msg("'CONST' expected")
-| 13: Msg("'=' expected")
-| 14: Msg("'+' expected")
-| 15: Msg("'-' expected")
-| 16: Msg("'TYPE' expected")
-| 17: Msg("'PACKED' expected")
-| 18: Msg("'^' expected")
-| 19: Msg("'..' expected")
-| 20: Msg("'ARRAY' expected")
-| 21: Msg("'[' expected")
-| 22: Msg("']' expected")
-| 23: Msg("'OF' expected")
-| 24: Msg("'RECORD' expected")
-| 25: Msg("'END' expected")
-| 26: Msg("'SET' expected")
-| 27: Msg("'FILE' expected")
-| 28: Msg("':' expected")
-| 29: Msg("'CASE' expected")
-| 30: Msg("'VAR' expected")
-| 31: Msg("'PROCEDURE' expected")
-| 32: Msg("'FUNCTION' expected")
-| 33: Msg("'FORWARD' expected")
-| 34: Msg("'BEGIN' expected")
-| 35: Msg("':=' expected")
-| 36: Msg("'GOTO' expected")
-| 37: Msg("'WHILE' expected")
-| 38: Msg("'DO' expected")
-| 39: Msg("'REPEAT' expected")
-| 40: Msg("'UNTIL' expected")
-| 41: Msg("'IF' expected")
-| 42: Msg("'THEN' expected")
-| 43: Msg("'ELSE' expected")
-| 44: Msg("'FOR' expected")
-| 45: Msg("'TO' expected")
-| 46: Msg("'DOWNTO' expected")
-| 47: Msg("'WITH' expected")
-| 48: Msg("'<' expected")
-| 49: Msg("'>' expected")
-| 50: Msg("'<=' expected")
-| 51: Msg("'>=' expected")
-| 52: Msg("'<>' expected")
-| 53: Msg("'IN' expected")
-| 54: Msg("'OR' expected")
-| 55: Msg("'*' expected")
-| 56: Msg("'/' expected")
-| 57: Msg("'DIV' expected")
-| 58: Msg("'MOD' expected")
-| 59: Msg("'AND' expected")
-| 60: Msg("'NOT' expected")
-| 61: Msg("'NIL' expected")
-| 62: Msg("not expected")
-| 63: Msg("invalid UnsignedLiteral")
-| 64: Msg("invalid MulOp")
-| 65: Msg("invalid Factor")
-| 66: Msg("invalid AddOp")
-| 67: Msg("invalid RelOp")
-| 68: Msg("invalid SimpleExpression")
-| 69: Msg("invalid ForStatement")
-| 70: Msg("invalid AssignmentOrCall")
-| 71: Msg("invalid ParamType")
-| 72: Msg("invalid FormalSection")
-| 73: Msg("invalid Body")
-| 74: Msg("invalid StructType")
-| 75: Msg("invalid SimpleType")
-| 76: Msg("invalid Type")
-| 77: Msg("invalid UnsignedNumber")
-| 78: Msg("invalid Constant")
-| 79: Msg("invalid Constant")
-| 80: Msg("invalid ProcDeclarations")

binární
Test/PascalP.o


binární
Test/PascalS.o


+ 0 - 9
Test/gen.log

@@ -1,9 +0,0 @@
-/mnt/EricRaid/eric/bin/Modula2/Gm2/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.1/m2/m2iso/RndFile.def:27:18: error: In definition module « RndFile »: the constructor type is « FlagSet » and this is different from the constant constant set which has a type « FlagSet »
-   27 |    read = FlagSet{ChanConsts.readFlag};
-      |                  ^
-/mnt/EricRaid/eric/bin/Modula2/Gm2/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.1/m2/m2iso/TermFile.def:31:17: error: In definition module « TermFile »: the constructor type is « FlagSet » and this is different from the constant constant set which has a type « FlagSet »
-   31 |   read = FlagSet{ChanConsts.readFlag};
-      |                 ^
-/mnt/EricRaid/eric/bin/Modula2/Gm2/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.1/m2/m2iso/ChanConsts.def:33:17: error: In definition module « ChanConsts »: the constructor type is « FlagSet » and this is different from the constant constant set which has a type « FlagSet »
-   33 |   read = FlagSet{readFlag};   (* input operations are requested/available *)
-      |                 ^

+ 0 - 65
Test/modules.lst

@@ -1,65 +0,0 @@
-SYSTEM
-ASCII
-Strings
-StrLib
-Environment
-CFileSysOp
-Indexing
-SysExceptions
-M2EXCEPTION
-RTExceptions
-M2Dependent
-M2RTS
-wrapc
-FIO
-errno
-termios
-IO
-StdIO
-StrIO
-NumberIO
-Debug
-Selective
-ldtoa
-dtoa
-StringConvert
-M2Diagnostic
-SysStorage
-RTentity
-EXCEPTIONS
-Storage
-Assertion
-DynamicStrings
-StringFileSysOp
-FileSysOp
-wrapclock
-UnixArgs
-Args
-SysClock
-IOConsts
-ChanConsts
-IOLink
-RTio
-ErrnoCategory
-RTgenif
-RTfio
-RTgen
-StdChans
-IOChan
-RTdata
-ProgramArgs
-CharClass
-TextUtil
-TextIO
-RawIO
-ConvTypes
-WholeConv
-StringChan
-WholeIO
-IOResult
-RndFile
-TermFile
-FileIO
-PascalS
-PascalP
-Pascal

+ 0 - 280
Test/pascal.lst

@@ -1,280 +0,0 @@
-Coco/R - Compiler-Compiler V1.53
-Released by Pat Terry 17 September 2002
-Source file: pascal.atg
-
-Grammar Tests:
-
-Deletable symbols:
-     Statement
-     StatementSequence
-     ReturnType
-     FieldList
-     VarDeclarations
-     TypeDefinitions
-     ConstDefinitions
-     LabelDeclarations
-     DeclarationPart
-Undefined nonterminals:   -- none --
-Unreachable nonterminals: -- none --
-Circular derivations:     -- none --
-Underivable nonterminals: -- none --
-LL(1) conditions:
- LL(1) error in CaseList: ";" is the start & successor of a deletable structure
- LL(1) error in IfStatement: "ELSE" is the start & successor of a deletable structure
- LL(1) error in VariantSelector: identifier is the start & successor of a deletable structure
- LL(1) error in VariantPart: ";" is the start & successor of a deletable structure
- LL(1) error in fixedPart: ";" is the start & successor of a deletable structure
- LL(1) error in FieldList: ";" is the start & successor of a deletable structure
- LL(1) error in SimpleType: identifier is the start of several alternatives.
-
-Listing:
-
-    1  COMPILER Pascal
-    2  (* J & W Pascal - not Turbo Pascal *)
-    3  (* This grammar is not LL(1) *)
-    4  
-    5  IGNORE CASE
-    6  
-    7  CHARACTERS
-    8    eol      = CHR(13) .
-    9    letter   = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" .
-   10    digit    = "0123456789".
-   11    noQuote1 = ANY - "'" - eol .
-   12  
-   13  IGNORE CHR(9) .. CHR(13)
-   14  
-   15  COMMENTS FROM "(*" TO "*)"
-   16  COMMENTS FROM "{" TO "}"
-   17  
-   18  TOKENS
-   19    identifier  =  letter { letter | digit } .
-   20    integer     =  digit { digit } | digit { digit }  CONTEXT ("..") .
-   21    real        =  digit { digit } "." digit { digit }
-   22                   [ "E" ["+" | "-"] digit { digit } ]
-   23                   |  digit { digit } "E" ["+" | "-"] digit { digit }  .
-   24    string      = "'" { noQuote1 | "''" } "'" .
-   25  
-   26  PRODUCTIONS
-   27  
-   28    Pascal            = "program"  NewIdent [ ExternalFiles ] ";"
-   29                        Block "." .
-   30  
-   31    ExternalFiles     = "(" NewIdentList ")" .
-   32  
-   33    Block             =  DeclarationPart StatementPart .
-   34  
-   35    DeclarationPart   = LabelDeclarations ConstDefinitions
-   36                        TypeDefinitions VarDeclarations
-   37                        { ProcDeclarations } .
-   38  
-   39  (* -------------------------------------------------------------------- *)
-   40  
-   41    LabelDeclarations = [ "label" Labels ";" ] .
-   42  
-   43    Labels            = Label { "," Label } .
-   44  
-   45    Label             = UnsignedInt .
-   46  
-   47  (* -------------------------------------------------------------------- *)
-   48  
-   49    ConstDefinitions  = [ "const" ConstDef { ConstDef } ] .
-   50  
-   51    ConstDef          = NewIdent "=" Constant ";" .
-   52  
-   53    Constant          = [ "+" | "-" ] ( UnsignedNumber | ConstIdent ) | String .
-   54  
-   55    UnsignedNumber    = UnsignedInt | UnsignedReal .
-   56  
-   57    ConstIdent        = identifier .
-   58  
-   59  (* -------------------------------------------------------------------- *)
-   60  
-   61    TypeDefinitions   = [ "type" TypeDef { TypeDef } ] .
-   62  
-   63    TypeDef           = NewIdent "=" Type ";" .
-   64  
-   65    Type              = SimpleType | [ "packed" ] StructType | "^" TypeIdent .
-   66  
-   67    SimpleType        = TypeIdent | EnumerationType | SubrangeType .
-   68  
-   69    TypeIdent         = identifier .
-   70  
-   71    EnumerationType   = "(" NewIdentList ")" .
-   72  
-   73    SubrangeType      = Constant ".." Constant .
-   74  
-   75    StructType        = ArrayType | RecordType | SetType | FileType .
-   76  
-   77    ArrayType         = "array" "[" IndexList "]" "of" Type .
-   78  
-   79    IndexList         = SimpleType { "," SimpleType } .
-   80  
-   81    RecordType        = "record" FieldList "end" .
-   82  
-   83    SetType           = "set" "of" SimpleType .
-   84  
-   85    FileType          = "file" "of" Type .
-   86  
-   87    FieldList         = [ ( fixedPart [ ";" VariantPart ] | VariantPart ) [ ";" ] ] .
-   88  
-   89    fixedPart         = RecordSection { ";" RecordSection } .
-   90  
-   91    RecordSection     = NewIdentList ":" Type .
-   92  
-   93    VariantPart       = "case" VariantSelector "of" Variant { ";" Variant } .
-   94  
-   95    VariantSelector   = [ NewIdent ":" ] TypeIdent .
-   96  
-   97    Variant           = CaseLabelList ":" "(" FieldList ")" .
-   98  
-   99  (* -------------------------------------------------------------------- *)
-  100  
-  101    VarDeclarations   = [ "var" VarDecl { VarDecl } ] .
-  102  
-  103    VarDecl           = NewIdentList ":" Type ";" .
-  104  
-  105  (* -------------------------------------------------------------------- *)
-  106  
-  107    ProcDeclarations  = ( ProcHeading | FuncHeading ) ";" Body ";" .
-  108  
-  109    ProcHeading       = "procedure" NewIdent [ FormalParams ] .
-  110  
-  111    FuncHeading       = "function" NewIdent [ FormalParams ] ReturnType .
-  112  
-  113    ReturnType        = [ (* empty if forward referenced *) ":" TypeIdent ] .
-  114  
-  115    Body              = Block | "forward" .
-  116  
-  117    FormalParams      = "(" FormalSection { ";" FormalSection } ")"  .
-  118  
-  119    FormalSection     = [ "var" ] ParamGroup | ProcHeading | FuncHeading .
-  120  
-  121    ParamGroup        = NewIdentList ":" ParamType .
-  122  
-  123    ParamType         =   TypeIdent
-  124                        | "array" "[" IndexSpecList "]" "of" ParamType
-  125                        | "packed" "array" "[" IndexSpec "]" "of" TypeIdent .
-  126  
-  127    IndexSpecList     = IndexSpec { ";" IndexSpec } .
-  128  
-  129    IndexSpec         = NewIdent ".." NewIdent ":" TypeIdent .
-  130  
-  131  (* -------------------------------------------------------------------- *)
-  132  
-  133    StatementPart     = CompoundStatement .
-  134  
-  135    CompoundStatement = "begin" StatementSequence "end" .
-  136  
-  137    StatementSequence = Statement { ";" Statement } .
-  138  
-  139    Statement         = [ Label ":" ]
-  140                        [   AssignmentOrCall
-  141                          | CompoundStatement
-  142                          | GotoStatement
-  143                          | WhileStatement
-  144                          | RepeatStatement
-  145                          | IfStatement
-  146                          | CaseStatement
-  147                          | ForStatement
-  148                          | WithStatement ] .
-  149  
-  150    AssignmentOrCall  = Designator ( ":=" Expression | [ ActualParams ] ) .
-  151  
-  152    ActualParams      = "(" ActualParameter { "," ActualParameter } ")" .
-  153  
-  154    ActualParameter   = Expression [ FieldWidth (* only in i/o *) ] .
-  155  
-  156    FieldWidth        = ":" IntegerExpression [ ":" IntegerExpression ] .
-  157  
-  158    GotoStatement     = "goto" Label .
-  159  
-  160    WhileStatement    = "while" BooleanExpression "do" Statement .
-  161  
-  162    RepeatStatement   = "repeat" StatementSequence "until" BooleanExpression .
-  163  
-  164    IfStatement       = "if" BooleanExpression "then" Statement
-  165                        [ "else" Statement ] .
-  166  
-  167    CaseStatement     = "case" OrdinalExpression "of" CaseList "end" .
-  168  
-  169    CaseList          = OneCase { ";" OneCase } [ ";" ] .
-  170  
-  171    OneCase           = CaseLabelList ":" Statement .
-  172  
-  173    CaseLabelList     = CaseLabel { "," CaseLabel } .
-  174  
-  175    CaseLabel         = Constant .
-  176  
-  177    ForStatement      = "for" ControlVariable ":=" OrdinalExpression
-  178                        ( "to" | "downto" ) OrdinalExpression "do" Statement .
-  179  
-  180    ControlVariable   = identifier .
-  181  
-  182    WithStatement     = "with" RecVarList "do" Statement .
-  183  
-  184    RecVarList        = Designator { "," Designator } .
-  185  
-  186  (* -------------------------------------------------------------------- *)
-  187  
-  188    IntegerExpression = Expression .
-  189  
-  190    BooleanExpression = Expression .
-  191  
-  192    OrdinalExpression = Expression .
-  193  
-  194    Expression        = SimpleExpression [ RelOp SimpleExpression ] .
-  195  
-  196    RelOp             = "=" | "<" | ">" | "<=" | ">=" | "<>" | "in" .
-  197  
-  198    SimpleExpression  = ( "+" Term | "-" Term | Term ) { AddOp Term } .
-  199  
-  200    AddOp             = "+" | "-" | "or" .
-  201  
-  202    Term              = Factor { MulOp Factor } .
-  203  
-  204    MulOp             = "*" | "/" | "div" | "mod" | "and" .
-  205  
-  206    Factor            =   Designator [ ActualParams ]
-  207                        | UnsignedLiteral
-  208                        | SetConstructor
-  209                        | "(" Expression ")"
-  210                        | "not" Factor .
-  211  
-  212    Designator        = identifier { "." identifier | "[" ExpList "]" | "^" } .
-  213  
-  214    ExpList           = Expression { "," Expression } .
-  215  
-  216    UnsignedLiteral   = UnsignedNumber | "nil" | String .
-  217  
-  218    SetConstructor    = "[" Member { "," Member } "]" .
-  219  
-  220    Member            = Expression [ ".." Expression ] .
-  221  
-  222  (* -------------------------------------------------------------------- *)
-  223  
-  224    NewIdentList      = NewIdent { "," NewIdent } .
-  225  
-  226    NewIdent          = identifier .
-  227  
-  228    UnsignedInt       = integer .
-  229  
-  230    UnsignedReal      = real .
-  231  
-  232    String            = string .
-  233  
-  234  END Pascal.
-
-    0 errors
-
-
-Statistics:
-
-  nr of terminals:        63 (limit   400)
-  nr of non-terminals:    85 (limit   210)
-  nr of pragmas:           0 (limit   437)
-  nr of symbolnodes:     148 (limit   500)
-  nr of graphnodes:      434 (limit  1500)
-  nr of conditionsets:     5 (limit   100)
-  nr of charactersets:     6 (limit   250)
-
-

+ 0 - 0
Test/uselist.log