metasyn/derived/MetaSynBdl.m3


MODULE MetaSynBdl;
Generated by m3bundle; see its manpage.

IMPORT Bundle, BundleRep, Text;

TYPE T = Bundle.T OBJECT OVERRIDES
           get      := LookUp;
           getNames := GetNames;
         END;

TYPE Texts = REF ARRAY OF TEXT;

VAR
  bundle: T     := NIL;
  names : Texts := NIL;

PROCEDURE Get(): Bundle.T =
  BEGIN
    IF (bundle = NIL) THEN bundle := NEW (T) END;
    RETURN bundle;
  END Get;

PROCEDURE GetNames (<*UNUSED*> self: T): Texts =
  BEGIN
    IF names = NIL THEN
      names := NEW (Texts, NUMBER (Names));
      names^ := Names;
    END;
    RETURN names;
  END GetNames;

PROCEDURE LookUp (<*UNUSED*> self: T;  element: TEXT): TEXT =
  BEGIN
    FOR i := 0 TO LAST (Names)-1 DO
      IF Text.Equal (Names[i], element) THEN
        RETURN Elements[i];
      END;
    END;
    RETURN NIL;
  END LookUp;

CONST Names = ARRAY [0..2] OF TEXT {
  "MetaGram",
  "ExtendGram",
  NIL
};

CONST Elements = ARRAY [0..2] OF TEXT {
  E0,
  E1,
  NIL
};

CONST E0 =
   "grammar ::=\n     clauseSeq\nclauseSeq ::=\n     [ \tgramExpIde _1\n\t\""
 & "::=\" \n\tclauseExtends_2 \n\tgramExp_3\n\tclauseRest_4 \n\t] :: Clause"
 & "List\nclauseRest ::=\n     { \"EOF\" clauseSeq  }\nclauseExtends ::=\n "
 & "    { [ \".\" \".\" \".\" \n        { [ \"*\" { [ \"_\" int_3 ] :: Clau"
 & "seExtendsIterPos \n\t          []            :: ClauseExtendIterNoPos \n"
 & "                }_2 ]  :: ClauseExtendsIter \n          []           ::"
 & " ClauseExtendsChoice\n        }_1 \n       ]   :: ClauseExtendsYes\n   "
 & "    []  :: ClauseExtendsNo\n     }_1\n\ngramExpIde ::=\n     ide\n\ngra"
 & "mExp ::=\n     [ gramExpBase_1 \n\t{ [ \"_\" int_3 ]::Storage [ \"::\" "
 & "sum_3 ]::caction []::select1 }_2 \n     ]::select2\n\n\ngramExpBase ::="
 & "\n     { ide_1    :: GramIde\n       string_1 :: GramString\n       \"i"
 & "de\"    :: GramKeyIde\n       \"int\"    :: GramKeyInt\n       \"EOF\" "
 & "   :: GramKeyEof\n       \"real\"   :: GramKeyReal\n       \"char\"   :"
 & ": GramKeyChar\n       \"string\" :: GramKeyString \n       gramExpSeque"
 & "nce \n       gramExpChoice   \n       gramExpParens \n     }\n\ngramExp"
 & "Sequence ::=\n     [ \"[\" gramExpList \"]\" ]   :: GramExpSequence\n  "
 & "\ngramExpChoice ::=\n     [ \"{\" gramExpList_1 \"}\" ] :: GramExpChoic"
 & "e\n  \ngramExpParens ::=\n     [ \"(\" gramExp_1\n     { [ \"*\" { [ \""
 & "_\" int_4 gramExp_3  ] :: GramExpIterPos\n               gramExp_3     "
 & "           :: GramExpIterNoPos  \n             }_5 ]  :: GramExpIter\n "
 & "      []           :: GramExpBase   }_6\n     \")\" ]  :: GramExpParens"
 & "\n  \ngramExpList ::=\n     { [ gramExp_1 gramExpList_2 ]::GramList [] "
 & "}\n  \n  \n\n\n";

CONST E1 =
   "(* Grammar file for extensible grammars, using MPTreeSubst as their\n  "
 & " substitution\troutine *)\n\ngrammar ::=\n     clauseSeq\nclauseSeq ::="
 & "\n     [ \tgramExpIde _1\n        paramList_5\n\t\"::=\" \n\tclauseExte"
 & "nds_2 \n\tgramExp_3\n\tclauseRest_4 \n\t] :: ClauseList\nclauseRest ::="
 & "\n     { clauseSeq [] }\nclauseExtends ::=\n     { [ \".\" \".\" \".\" "
 & "\n        { [ \"*\" { [ \"_\" int_3 ] :: ClauseExtendsIterPos \n\t     "
 & "     []            :: ClauseExtendsIterNoPos \n                }_2 ]  :"
 & ": ClauseExtendsIter \n          []           :: ClauseExtendsChoice\n  "
 & "      }_1 \n       ]   :: ClauseExtendsYes\n       []  :: ClauseExtends"
 & "No\n     }\n\n\n\nparamList ::= { [ \"<\" paramList2_1 \">\" ]::select1"
 & " [] }\nparamList2 ::= { [ \"_\" int_1 { [ \",\" paramList2_2 ]::select2"
 & " [] }_2 ]::cons [] }\n\n\n(*3456789012345678901234567890123456789012345"
 & "678901234567890*)\n(*       1         2         3         4         5  "
 & "        *)\n\ngramExp ::=\n     [ gramExpBase_1 \n\t{ [ \"_\" int_3 ]::"
 & "Storage \n          [ ExtendAction<_1>_2 ] :: select2\n          []::se"
 & "lect1 }_2 \n     ]::select2\n\n\ngramExpBase ::=\n     { [ ide_1 paramL"
 & "ist_2 ] :: GramIde\n       string_1              :: GramString\n       "
 & "\"ide\"                 :: GramKeyIde\n       \"int\"                 :"
 & ": GramKeyInt\n       \"EOF\"                 :: GramKeyEof\n       \"re"
 & "al\"                :: GramKeyReal\n       \"char\"                :: G"
 & "ramKeyChar\n       \"string\"              :: GramKeyString \n       gr"
 & "amExpSequence \n       gramExpChoice   \n       gramExpParens \n     }\n"
 & "\ngramExpIde ::=\n     ide_1 :: Ide\n\n\ngramExpSequence ::=\n     [ \""
 & "[\" gramExpList_1 \"]\" ]   :: GramExpSequence\n  \ngramExpChoice ::=\n"
 & "     [ \"{\" gramExpList_1 \"}\" ] :: GramExpChoice\n  \ngramExpParens "
 & "::=\n     [ \"(\" gramExp_1\n     { [ \"*\" { [ \"_\" int_4 gramExp_3  "
 & "] :: GramExpIterPos\n               gramExp_3                :: GramExp"
 & "IterNoPos  \n             }_5 ]  :: GramExpIter\n       []           ::"
 & " GramExpBase   }_6\n     \")\" ]  :: GramExpParens\n  \ngramExpList ::="
 & "\n     { [ gramExp_1 gramExpList_2 ]::GramList [] }\n\n\n\n\n\n\n\n";

BEGIN
END MetaSynBdl.