%!
%% Copyright (C) 1989, Digital Equipment Corporation
%% All rights reserved.
%% See the file COPYRIGHT for a full description.
%%
%%Title:         m3syntax.txt
%%Creator:       Bill Kalsow
%%CreationDate:  Fri Oct 23 13:21:27 1987 by kalsow
%%EditDate:      Last modified on Fri Oct  4 19:48:30 1991 by kalsow
%%EditDate:           modified on Tue Jul  3 20:09:14 1990 by muller

%%
%%  railroad diagrams for Modula-3's grammar
%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% railroad primitives

/SCALE 8.5 def  % sizing parameter
#include "railroad.h"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

500 dict begin % local Modula-3 dictionary

#include "m3grammar.h"

/MaxY            7.8 inches def
/MinY            0.3 inches def
/MaxX            11  inches def

/StartColumn     { /LastY MaxY def } def
/ColumnOne       { /BaseX   0 def  StartColumn } def
/ColumnTwo       { /BaseX MaxX 2 div def  StartColumn } def
/Landscape       { 270 rotate 11 neg inches 0 translate } def
/ResetGraphics   { Landscape SCALE 10 div setlinewidth } def
/ShowPage        { showpage ResetGraphics } def
/FlushPage       { ShowPage  ColumnOne } def
/CheckBottom     { LastY MinY lt { FlushPage } if } def

/DoIt {                 % rule indent
    CheckBottom         % rule indent
    5 SCALE mul mul     % rule 5*S*indent
    BaseX add           % rule 5*S*indent+Col
    LastY               % rule 5*S*indent+Col LastY
    3 -1 roll           %      5*S*indent+Col LastY rule
    DrawProduction      % height
    LastY sub neg       % LastY-height
    BOXHgt sub          % LastY-height-BOXHgt
    /LastY exch def     %
  } def % DoIt

ResetGraphics
ColumnOne

 CompilationUnit       1 DoIt
 Interface             1 DoIt
 Module                1 DoIt
 GenericInterface      1 DoIt
 GenericModule         1 DoIt
LastY
 GenericHead           1 DoIt
 Import                1 DoIt
 Block                 1 DoIt
/LastY exch def
 InterfaceBody         6 DoIt
 ModuleBody            6 DoIt

ColumnTwo

 Declaration           1 DoIt
 ConstDeclaration      1 DoIt
 TypeDeclaration       1 DoIt
 ExceptionDeclaration  1 DoIt
 VariableDeclaration   1 DoIt
 Revelation            1 DoIt
 ProcedureHeading      1 DoIt

FlushPage

 StatementSequence     1 DoIt
%%  statement             1.5 DoIt

 AssignmentStatement   1 DoIt
 CallStatement         1 DoIt
 actual                2 DoIt

ColumnTwo /BaseX BaseX 1.0 inches sub def

LastY
 ExitStatement          7 DoIt
/LastY exch def
 CaseStatement         -2 DoIt
 
LastY
 EvalStatement          6.5 DoIt
/LastY exch def
  case                 -1 DoIt

LastY
 DecStatement          -2 DoIt
/LastY exch def
 IncStatement           4 DoIt

 ForStatement          -2 DoIt
 IfStatement           -2 DoIt

LastY
 LockStatement         -2 DoIt
/LastY exch def
 LoopStatement          4 DoIt

LastY
 RaiseStatement        -2 DoIt
/LastY exch def
 RepeatStatement        4 DoIt

LastY
 ReturnStatement       -2 DoIt
/LastY exch def
 TryFinallyStatement    4 DoIt

 TryStatement          -2 DoIt
 TypeCaseStatement     -2 DoIt

LastY
  handler              -1.5 DoIt
/LastY exch def
  tcase                 4.2 DoIt

LastY
 WhileStatement        -2 DoIt
/LastY exch def
 WithStatement          4 DoIt

FlushPage

 Type                  1 DoIt
 ArrayType             1 DoIt
 PackedType            1 DoIt
 EnumerationType       1 DoIt
 ObjectType            1 DoIt
   Brand               2 DoIt
   methodList          2 DoIt
   method              2 DoIt

ColumnTwo  /BaseX BaseX 0.75 inches sub def

 ProcedureType         1 DoIt
 RecordType            1 DoIt
 RefType               1 DoIt
 SetType               1 DoIt
 SubrangeType          1 DoIt
LastY
   fields              1.5 DoIt
/LastY exch def
   field               4.0 DoIt
   overrideList        1.5 DoIt
 Signature             1.5 DoIt
  formals              1.5 DoIt
  formal               1.5 DoIt

FlushPage

 ConstExpression       1 DoIt
 Expression            1 DoIt
   e1                  2 DoIt
   e2                  2 DoIt
   e3                  2 DoIt
   e4                  2 DoIt
   e5                  2 DoIt
   e6                  2 DoIt
%   e7                  2 DoIt

ColumnTwo

   e8                  2 DoIt
 Constructor           1 DoIt
    setCons            2 DoIt
    recordCons         2 DoIt
    arrayCons          2 DoIt

 TypeID                1 DoIt
 ExceptionID           1 DoIt

FlushPage

end % Modula-3 dictionary 
