GRAMMAR OF FILE TRANS.LAN


 rule
number

		{ This grammar defines the langage T of Thot
		  The notation used here is defined in file META.LAN
	 
		   ' '  : keyword
		   [ ]  : optional part
		   < >  : optional and repeatable part
		   /    : choice
	
		  V. Quint	January 1988	}
	
    1	TransSchema  =  'Translation' TypeIdent ';'
	              [ 'LineLength' MaxLineLength ';' ]
		      [ 'LineEnd' LineEndString ';' ]
		      [ 'LineEndInsert' LineEndInsertString ';' ]
	              [ 'Buffers' SeqOfBuffer ]
	              [ 'Counters' SeqOfCounter ]
	              [ 'Const' SeqOfConst ]
	              [ 'Var' SeqOfVariable ]
	                'Rules' TheRules
	              [ 'Attributes' SeqOfAttr ]
	              [ 'Presentation' SeqOfPres ]
	              < 'TextTranslate' TSeqOfTransl >
	              [ 'SymbTranslate' SeqOfTransl ]
	              [ 'GraphTranslate' SeqOfTransl ]
	                'End' .
	
    3	MaxLineLength =  NUMBER .
    4	LineEndString =  STRING .
    5	LineEndInsertString =  STRING .
	
    8	SeqOfConst =     ConstDcl < ConstDcl > .
   15	ConstDcl =       ConstIdent '=' ConstValue ';' .
   16	ConstIdent =     NAME .
   17	ConstValue =     STRING .
	
    7	SeqOfCounter =   CounterDcl < CounterDcl > .
   18	CounterDcl =     CounterIdent [ ':' CountFunction ] ';' .
   19	CounterIdent =   NAME .
   20	CountFunction =  'Rank' 'of' TypeIdent [ RelAncestorLevel ] [ 'Init' AttrIdent ] /
	                 'Rlevel' 'of' TypeIdent /
	                 'Set' InitValue 'On' TypeIdent 'Add' IncrValue
	                 'On' TypeIdent [ 'Init' AttrIdent ] .
   21	RelAncestorLevel = [ '-' ] AncestorLevel .
   25	AncestorLevel =	 NUMBER .
   23	InitValue =      NUMBER .
   24	IncrValue =      NUMBER .
    2	TypeIdent =      NAME .
	
    6	SeqOfBuffer =    BufferDcl < BufferDcl > .
   26	BufferDcl =      BufferIdent [ '(' 'Picture' ')' ] ';' .
   27	BufferIdent =    NAME .
	
    9	SeqOfVariable =  VariableDcl < VariableDcl > .
   28	VariableDcl =    VariableIdent ':' Function < Function > ';' .
   29	VariableIdent =  NAME .
   30	Function =       'Value' '(' CounterIdent [ ':' Length ] [ ',' CounterStyle ] ')' /
			 'FileDir' / 'FileName' / 'Extension' /
			 'DocumentName' / 'DocumentDir' /
			 ConstIdent / CharString / BufferIdent / AttrIdent .
   31	Length =	 NUMBER .
   32	CounterStyle =   'ARABIC' / 'UROMAN' / 'LROMAN' / 'UPPERCASE' / 'LOWERCASE' .
	
   33	CharString =     STRING .
	
   11	SeqOfAttr =      TransAttr < TransAttr > .
   34	TransAttr =      AttrIdent [ '(' TypeIdent ')' ] [ AttrRelat ] ':'
	                 SeqOfRules .
   22	AttrIdent =      NAME .
   35	AttrRelat =	 '=' AttrValue / '>' [ '-' ] MinVal / '<' [ '-' ] MaxVal /
			 'IN' '[' ['-'] MinInterval '.' '.' ['-'] MaxInterval ']' .
   37	AttrValue =	 [ '-' ] ValEqual / TextEqual / AttrValIdent .
   38	MinVal =	 NUMBER .
   39	MaxVal =	 NUMBER .
   40	MinInterval =	 NUMBER .
   41	MaxInterval =	 NUMBER .
   42	ValEqual =	 NUMBER .
   43	TextEqual =	 STRING .
   44	AttrValIdent =   NAME .
	
   10	TheRules =       TransType < TransType > .
   45	TransType =      [ FirstSec ] TypeIdent ':' SeqOfRules .
   46	FirstSec =	 'First' / 'Second' .
	
   36	SeqOfRules =     'Begin' < CondRules > 'End' ';' / CondRules .
   47	CondRules =       Rule1 / Rule2 .
	
   49	Rule2 =          'If' SeqOfCond SeqOfRules1 .
   50	SeqOfCond =      Condition < 'And' Condition > .
	
   52	Condition =      [ 'Not' ] [ 'Target' ] Cond .
   53	Cond =		 CondOnSelf / CondAscend .
   54	CondOnSelf =     'Defined' /
	                 'FirstRef' / 'LastRef' / 'ExternalRef' /
			 'Alphabet' '=' Alphabet /
			 'FirstAttr' / 'LastAttr' /
			 'ComputedPage' / 'StartPage' / 'UserPage' / 'ReminderPage' /
			 'Empty' .
	
   55	CondAscend =     [ Ascend ] CondOnAscend .
   57	Ascend =         '*' / 'Parent' / 'Ancestor' LevelOrType .
   59	LevelOrType =    CondRelLevel / TypeIdent [ '(' TypeIdent ')' ] .
   60	CondRelLevel =   NUMBER .
   58	CondOnAscend =   'First' / 'Last' /
	                 'Refered' / 'Referred' /
		         [ 'Immediately' ] 'Within' [ ParentLevel ] TypeIdent
	                                                      [ '(' TypeIdent ')' ] /
		         'FirstWithin' [ ParentLevel ] TypeIdent
	                                                      [ '(' TypeIdent ')' ] /
			 'Attributes' /
			  AttrIdent [ AttrRelat ] /
			  TypeIdent /
	                 'Presentation' / PresRule / 'Comment' .
	
   61	ParentLevel =	 [ GreaterLess ] RelLevel .
   63	GreaterLess =	 '>' / '<' .
   64	RelLevel =	 NUMBER .
   65	TrSchema =       NAME .
	
   51	SeqOfRules1 =    'Begin' < Rule1 > 'End' ';' / Rule1 .
	
   48	Rule1 =		 RuleA / RuleB .
   66	RuleA =          'Create' [ 'IN' VariableIdent ] Token [ Position ] ';' /
	                 'Get' [ RelPosition ] TypeIdent [ '(' TypeIdent ')' ]
	                       [ Position ] ';' /
			 'Copy' [ RelPosition ] TypeIdent [ '(' TypeIdent ')' ]
		                [ Position ] ';' /
	                 'Use' TrSchema [ 'For' TypeIdent ] ';' /
	                 'Remove' ';' /
		         'Write' Token [ Position ] ';' /
	                 'Read' BufferIdent [ Position ] ';' /
	                 'Include' File [ Position ] ';' /
			 'NoTranslation' ';' /
	                 'NoLineBreak' ';' .
   67	RuleB =		 'ChangeMainFile' VariableIdent [ Position ] ';' /
			 'Set' CounterIdent InitValue [ Position ] ';' /
			 'Add' CounterIdent IncrValue [ Position ] ';' /
	                 'Indent' [ 'IN' VariableIdent ] [ IndentSign ] IndentVal
	                          [ Position ] ';' /
			 'RemoveFile' VariableIdent [ Position ] ';' .
	
   72	IndentSign =     '+' / '-' .
   73	IndentVal =	 NUMBER .
	
   68	Token =		 ConstIdent / VariableIdent /
			 'Refered' VarOrType [ '(' TypeIdent ')' ] /
			 'Referred' VarOrType [ '(' TypeIdent ')' ] /
	                 CharString /
	                 BufferIdent / '(' Function < Function > ')' /
	                 AttrIdent / 'Value' / 'Content' / 'Comment' /
			 'FileDir' / 'FileName' / 'Extension' /
			 'DocumentName' / 'DocumentDir' /
	                 'Attributes' / 'Presentation' / 'RefId' / 'PairId' .
   74	VarOrType =	 'DocumentName' / 'DocumentDir' / 'RefId' /
			 VariableIdent / TypeIdent .
   69	Position =       'After' / 'Before' .
   70	RelPosition =    'Included' / 'Refered' / 'Referred' .
	
   71	File =           FileName / BufferIdent .
	
   13	TSeqOfTransl =   [ Alphabet ] SeqOfTransl .
   56	Alphabet =       NAME .
   14	SeqOfTransl =    'Begin' < Translation > 'End' ';' /
	                 Translation .
   76	Translation =    Source [ '-' '>' Target ] ';' .
   77	Source =         STRING .
   78	Target =         STRING .
   75	FileName =       STRING .
	
   12	SeqOfPres =      TransPres < TransPres > .
   79	TransPres =      PresRule ':' SeqOfRules .
   62	PresRule =       'Size' [ PresRelat ] /
	                 'Indent' [ PresRelat ] /
	                 'LineSpacing' [ PresRelat ] /
	                 'Adjust' [ '=' AdjustVal ] /
		         'Justify' [ '=' BooleanVal ] /
		         'Hyphenate' [ '=' BooleanVal ] /
	                 'Style' [ '=' StyleVal ] /
	                 'Font' [ '=' FontVal ] /
	                 'UnderLine' [ '=' UnderLineVal ] /
		          'Thickness' [ '=' UnderLStyleVal ] /
			 'LineStyle' [ '=' LineStyleVal ] /
			 'LineWeight' [ PresRelat ] /
			 'FillPattern' [ '=' Pattern ] /
			 'Background' [ '=' Color ] /
			 'Foreground' [ '=' Color ] .
   80	PresRelat =      '=' PresValue /
	                 '>' [ '-' ] MinimumPres /
	                 '<' [ '-' ] MaximumPres /
	                 'IN' '[' [ '-' ] MinIntervalPres '.' '.'
	                          [ '-' ] MaxIntervalPres ']' .
   81	AdjustVal =      'Left' / 'Right' / 'VMiddle' / 'LeftWithDots' .
   82	BooleanVal =     'Yes' / 'No' .
   83	StyleVal =       'Bold' / 'Italics' / 'Roman' / 'BoldItalics' /
	                 'Oblique' / 'BoldOblique' .
   84	FontVal =        'Times' / 'Helvetica' / 'Courier' .
   85	UnderLineVal =   'NoUnderline' / 'Underlined' / 'Overlined' / 'CrossedOut' /
			 { the following values are obsolete }
	                 'No' / 'UnderLine' / 'OverLine' / 'StrikeOut' .
   86	UnderLStyleVal = 'Thick' / 'Thin' .
	
   87	LineStyleVal =   'Solid' / 'Dashed' / 'Dotted' .
   88	Pattern =        NAME .
   89	Color =          NAME .
	
   91	MinimumPres =    NUMBER .
   92	MaximumPres =    NUMBER .
   93	MinIntervalPres= NUMBER .
   94	MaxIntervalPres= NUMBER .
   90	PresValue =      [ '-' ] PresVal .
   95	PresVal =        NUMBER .
	
	END
	


*** SHORT KEY-WORDS ***

code  character  numbers of rules using the key-word

1001      ;       1   1   1   1  15  18  26  28  36  51  66  66  66  66  66  66
                 66  66  66  66  67  67  67  67  67  14  76
1002      =      15  35  54  62  62  62  62  62  62  62  62  62  62  62  80
1003      :      18  28  30  34  45  79
1004      -      21  35  35  35  35  37  72  76  80  80  80  80  90
1005      (      26  30  34  59  58  58  66  66  68  68  68
1006      )      26  30  34  59  58  58  66  66  68  68  68
1007      ,      30
1008      >      35  63  76  80
1009      <      35  63  80
1010      [      35  80
1011      .      35  35  80  80
1012      ]      35  80
1013      *      57
1014      +      72



*** LONG KEY-WORDS ***

code  key-word      numbers of rules using the key-word

1101  Translation      1
1102  LineLength       1
1103  LineEnd          1
1104  LineEndInsert    1
1105  Buffers          1
1106  Counters         1
1107  Const            1
1108  Var              1
1109  Rules            1
1110  Attributes       1  58  68
1111  Presentation     1  58  68
1112  TextTranslate    1
1113  SymbTranslate    1
1114  GraphTranslate   1
1115  End              1  36  51  14
1116  Rank            20
1117  of              20  20
1118  Init            20  20
1119  Rlevel          20
1120  Set             20  67
1121  On              20  20
1122  Add             20  67
1123  Picture         26
1124  Value           30  68
1125  FileDir         30  68
1126  FileName        30  68
1127  Extension       30  68
1128  DocumentName    30  68  74
1129  DocumentDir     30  68  74
1130  ARABIC          32
1131  UROMAN          32
1132  LROMAN          32
1133  UPPERCASE       32
1134  LOWERCASE       32
1135  IN              35  66  67  80
1136  First           46  58
1137  Second          46
1138  Begin           36  51  14
1139  If              49
1140  And             50
1141  Not             52
1142  Target          52
1143  Defined         54
1144  FirstRef        54
1145  LastRef         54
1146  ExternalRef     54
1147  Alphabet        54
1148  FirstAttr       54
1149  LastAttr        54
1150  ComputedPage    54
1151  StartPage       54
1152  UserPage        54
1153  ReminderPage    54
1154  Empty           54
1155  Parent          57
1156  Ancestor        57
1157  Last            58
1158  Refered         58  68  70
1159  Referred        58  68  70
1160  Immediately     58
1161  Within          58
1162  FirstWithin     58
1163  Comment         58  68
1164  Create          66
1165  Get             66
1166  Copy            66
1167  Use             66
1168  For             66
1169  Remove          66
1170  Write           66
1171  Read            66
1172  Include         66
1173  NoTranslation   66
1174  NoLineBreak     66
1175  ChangeMainFile  67
1176  Indent          67  62
1177  RemoveFile      67
1178  Content         68
1179  RefId           68  74
1180  PairId          68
1181  After           69
1182  Before          69
1183  Included        70
1184  Size            62
1185  LineSpacing     62
1186  Adjust          62
1187  Justify         62
1188  Hyphenate       62
1189  Style           62
1190  Font            62
1191  UnderLine       62  85
1192  Thickness       62
1193  LineStyle       62
1194  LineWeight      62
1195  FillPattern     62
1196  Background      62
1197  Foreground      62
1198  Left            81
1199  Right           81
1200  VMiddle         81
1201  LeftWithDots    81
1202  Yes             82
1203  No              82  85
1204  Bold            83
1205  Italics         83
1206  Roman           83
1207  BoldItalics     83
1208  Oblique         83
1209  BoldOblique     83
1210  Times           84
1211  Helvetica       84
1212  Courier         84
1213  NoUnderline     85
1214  Underlined      85
1215  Overlined       85
1216  CrossedOut      85
1217  OverLine        85
1218  StrikeOut       85
1219  Thick           86
1220  Thin            86
1221  Solid           87
1222  Dashed          87
1223  Dotted          87



*** TABLE OF RULES AND REFERENCES ***

The code is the code of the symbol and the code of the rule
where that symbol appears in the left part. For each symbole,
the rule numbers indicate the rules that use that symbol in
right part.

 code  symbol        rule numbers

    1  TransSchema        
    2  TypeIdent             1  20  20  20  20  34  45  59  59  58  58  58  58
                              58  66  66  66  66  66  68  68  74
    3  MaxLineLength         1
    4  LineEndString         1
    5  LineEndInsertString   1
    6  SeqOfBuffer           1
    7  SeqOfCounter          1
    8  SeqOfConst            1
    9  SeqOfVariable         1
   10  TheRules              1
   11  SeqOfAttr             1
   12  SeqOfPres             1
   13  TSeqOfTransl          1
   14  SeqOfTransl           1   1  13
   15  ConstDcl              8   8
   16  ConstIdent           15  30  68
   17  ConstValue           15
   18  CounterDcl            7   7
   19  CounterIdent         18  30  67  67
   20  CountFunction        18
   21  RelAncestorLevel     20
   22  AttrIdent            20  20  30  34  58  68
   23  InitValue            20  67
   24  IncrValue            20  67
   25  AncestorLevel        21
   26  BufferDcl             6   6
   27  BufferIdent          26  30  66  68  71
   28  VariableDcl           9   9
   29  VariableIdent        28  66  67  67  67  68  74
   30  Function             28  28  68  68
   31  Length               30
   32  CounterStyle         30
   33  CharString           30  68
   34  TransAttr            11  11
   35  AttrRelat            34  58
   36  SeqOfRules           34  45  79
   37  AttrValue            35
   38  MinVal               35
   39  MaxVal               35
   40  MinInterval          35
   41  MaxInterval          35
   42  ValEqual             37
   43  TextEqual            37
   44  AttrValIdent         37
   45  TransType            10  10
   46  FirstSec             45
   47  CondRules            36  36
   48  Rule1                47  51  51
   49  Rule2                47
   50  SeqOfCond            49
   51  SeqOfRules1          49
   52  Condition            50  50
   53  Cond                 52
   54  CondOnSelf           53
   55  CondAscend           53
   56  Alphabet             54  13
   57  Ascend               55
   58  CondOnAscend         55
   59  LevelOrType          57
   60  CondRelLevel         59
   61  ParentLevel          58  58
   62  PresRule             58  79
   63  GreaterLess          61
   64  RelLevel             61
   65  TrSchema             66
   66  RuleA                48
   67  RuleB                48
   68  Token                66  66
   69  Position             66  66  66  66  66  66  67  67  67  67  67
   70  RelPosition          66  66
   71  File                 66
   72  IndentSign           67
   73  IndentVal            67
   74  VarOrType            68  68
   75  FileName             71
   76  Translation          14  14
   77  Source               76
   78  Target               76
   79  TransPres            12  12
   80  PresRelat            62  62  62  62
   81  AdjustVal            62
   82  BooleanVal           62  62
   83  StyleVal             62
   84  FontVal              62
   85  UnderLineVal         62
   86  UnderLStyleVal       62
   87  LineStyleVal         62
   88  Pattern              62
   89  Color                62  62
   90  PresValue            80
   91  MinimumPres          80
   92  MaximumPres          80
   93  MinIntervalPres      80
   94  MaxIntervalPres      80
   95  PresVal              90



*** REFERENCES TO BASIC TYPES ***

Numbers of the rules using NAME
  16  19   2  27  29  22  44  65  56  88  89

Numbers of the rules using NUMBER
   3  25  23  24  31  38  39  40  41  42  60  64  73  91  92  93  94  95

Numbers of the rules using STRING
   4   5  17  33  43  77  78  75
