~ubuntu-branches/ubuntu/wily/styx/wily

« back to all changes in this revision

Viewing changes to doc/styx.sgml

  • Committer: Package Import Robot
  • Author(s): Frederik Schüler
  • Date: 2013-12-28 18:20:37 UTC
  • mfrom: (0.1.5)
  • Revision ID: package-import@ubuntu.com-20131228182037-ihsf1de5y1oe24nf
Tags: 2.0.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
<author>Lars D&ouml;lle, Heike Manns
11
11
<htmlurl url="mailto:lars.doelle@on-line.de" name="lars.doelle@on-line.de">
12
12
<htmlurl url="mailto:heike@free-it.org" name="heike@free-it.org">
13
 
<date>Version 1.8, 7 November 2010
 
13
<date>Version 2.0.1, 7 July 2012
14
14
<abstract>
15
15
Styx is a scanner and parser generator designed to address some
16
16
shortcomings of the traditional lex/yacc combination.
174
174
be weird. Examples are languages that have no context-free grammar (like C, 
175
175
which comes with the context-dependent "typedef" construction).
176
176
<p>
177
 
This decision was made because Styx has been used for internal language
 
177
This decision was originally made because Styx has been used for internal language
178
178
design, therefore it did not have to cope with all the oddities out. Now that
179
179
we have released Styx to public use, this design decision may cause troubles
180
180
to other people, although one can work around these restrictions.
 
181
<p>
 
182
With the introduction of "dynamic" tokens in version 2.0.1 Styx is able to handle
 
183
context-dependent constructs like C's "typedef". 
 
184
Beside that users will be able to work around ambiguities in the syntax of programming
 
185
languages. One example for such an ambiguity is the "prefixexp" and "functioncall" definition 
 
186
in Lua's syntax. (see also <url url="http://www.lua.org/manual/5.1/manual.html#2.5" 
 
187
                                name="Lua reference manual 5.1, chapter 2.5.8">)
 
188
Reduce-reduce conflicts can be solved with the help of explicit reduction rules.
181
189
 
182
190
<sect1>Comparison to the lex/yacc combination
183
191
<p>
202
210
It only means that when one does weird things, the implementation may
203
211
become weird in these places and the support less handy.
204
212
<p>
205
 
More substantial restrictions are both in the parser and scanner. The parser
206
 
is LALR(1), which means that a look-ahead of only one token is supported.
 
213
More substantial restrictions are in the parser and - originally - the scanner. 
 
214
The parser is LALR(1), which means that a look-ahead of only one token is supported.
207
215
Likely the scanner, in versions prior to 1.7, does a look-ahead of only one character. 
208
216
This later restriction has been introduced to guarantee an effective scanner, which is
209
217
linear by the length of the string, while lex provides an arbitrary look
213
221
<p>
214
222
Additionally, lex allows to switch between different sets of tokens (languages) 
215
223
to be able to do even more weird things. Since version 1.6 the Styx scanner is able 
216
 
to handle different token sets, too. Like the lex/yacc combination, the scanner and 
217
 
parser are separated within Styx (also much more integrated), so one can plug-in any 
218
 
other, even a hand-crafted scanner, if nothing else helps.
 
224
to handle different token sets, too. 
 
225
<p>
 
226
Like the lex/yacc combination, the scanner and parser are separated within Styx 
 
227
(also much more integrated), so one can plug-in any other, even a hand-crafted scanner, 
 
228
if nothing else helps.
219
229
The disadvantage of doing so is again, that the many supports that Styx offers for 
220
230
the canonical design do not apply anymore. One has to write additional code, about 
221
231
to the amount that people applying the lex/yacc combination are already used to.
567
577
<item>An optional <tt>Regular Grammar</tt> section defining the tokens.
568
578
<item>An optional <tt>Context Free Grammar</tt> section, which, tautologically,
569
579
      is the section where the context free grammar is defined.
 
580
<item>Optional rules after the grammar definition to explicitly solve 
 
581
      reduce-reduce conflicts, introduced in styx version 2.0.1.
570
582
</itemize>
571
583
Note: Since version 1.3 the preprocessing facility <em>#include</em> can be used
572
584
      to modularize the specification in order to re-use parts of them.
580
592
  :non  :
581
593
  :cfg  : "Context" "Free" "Grammar" 
582
594
            Dfns
 
595
            Conflicts
583
596
 
584
597
  let QlxDfns0
585
598
  :nil  :
710
723
<p>
711
724
The reserved words are "Language", "Regular", "Grammar", "Context", "Free",
712
725
"let", "tok", "ign", "com", "ica", "ind", "lan", "InGroup", "ExGroup", "Group",
713
 
"other", "start" and "err". 
 
726
"other", "start", "err" and "reduce". 
714
727
Further, "cons", "nil" and words starting with "ign" have a special meaning 
715
728
when used as production names.
716
729
Since version 1.8 the production names "none" and "some" also have a special meaning 
729
742
different regular languages.
730
743
( see Example05 for a demonstration )
731
744
<p>
 
745
<label id="dynamic tokens">
 
746
Version 2.0.1 introduces "dynamic" tokens. They are declared to the parser with the 
 
747
QlxDfn-production "defd" and initially unknown to the scanner, i.e. have no regular expressions. 
 
748
With the help of a <ref id="dtok" name="special member production"> token values are assigned to 
 
749
them during the parse process.
 
750
( see Example08 for a demonstration )
 
751
<p>
732
752
<verb>
733
753
; REG-Section
734
754
 
739
759
 
740
760
  let QlxDfn  ; Qlx-Definition
741
761
  :defn : QlxCat QlxOpt QlxGrp0 Ide QlxGrp1 "=" ExpQuot ; regular expression definition
 
762
  :defd : "tok" "<" Ide ">"                             ; dynamic token
742
763
  :igrp : "InGroup" Ide                                 ; inclusive group definition
743
764
  :xgrp : "ExGroup" Ide                                 ; exclusive group definition
 
765
  !tgrp : "ExGroup" Ide "[" "tok" "]"                   ; and ignore keywords in group (version >= 2.0.1)
744
766
  :mgrp : "Group"   Ide = Ids                           ; group list definition, introduced in version 1.7
745
767
 
746
768
  let Ids  ; Group list members
974
996
Since version 1.8 Styx supports an EBNF-like notation for list ans optional members. 
975
997
(see the member syntax below and <ref id="example02" name="Example02"> for an application)
976
998
<p>
 
999
<label id="dtok">
 
1000
With the help of the member production "dtok" it is possible to introduce an as token X parsed value V as dynamic
 
1001
token Y, where X, Y are denoted by the left and right token identifiers. From that position within the parse process 
 
1002
the scanner always reports V as Y. (styx version >= 2.0.1)
 
1003
<p>
977
1004
The non-terminal names defined have to be unique within the scope of the source and disjunctive from the names 
978
1005
of the regular sets defined in the previous section. The production names have to be unique within each 
979
1006
non-terminal definition.
1014
1041
  :else : "[" "other" "]"
1015
1042
  :ign0 : Mbr1
1016
1043
  let Mbr1    ; Member
1017
 
  ; token or nonterminal
 
1044
  ; (dynamic) token or nonterminal
1018
1045
  :ntm  : Ide
1019
1046
 
1020
1047
  ; EBNF extension: optional list member
1024
1051
  ; EBNF extension: optional member
1025
1052
  :opt  : "[" OptKey Mbr1 OptKey "]"
1026
1053
 
 
1054
  ; introduction of dynamic token
 
1055
  :dtok : Ide "<" Ide ">"
 
1056
 
1027
1057
  let OptKey
1028
1058
  :nil  :
1029
1059
  :cons : Seq OptKey
1069
1099
  :nof  : "!"
1070
1100
</verb>
1071
1101
<p>
 
1102
<sect2>Explicit rules to solve reduce-reduce conflicts
 
1103
<p>
 
1104
Often language definitions are ambigous w.r.t LALR(1) parsing. As stated above one example is the 
 
1105
function call and expression syntax of <em>Lua</em>. 
 
1106
(see the styx grammar lua.sty which is part of Example07 as an application)
 
1107
<p>
 
1108
<verb>
 
1109
  let Conflicts    ; Conflict rules
 
1110
  :nil  : 
 
1111
  :cons : Conflict 
 
1112
          Conflicts
 
1113
 
 
1114
  let Conflict     ; Conflict rule (according diagnostic output)
 
1115
  :defn : "Context" State "." Token ":"
 
1116
          Rules
 
1117
 
 
1118
  let State        ; Conflict state
 
1119
  :nat : Nat       ; state index
 
1120
  :seq : Seq       ; state symbol (keyword)
 
1121
  :ide : Ide       ; state symbol (token, nonterminal)
 
1122
 
 
1123
  let Token        ; Conflict token
 
1124
  :seq : Seq
 
1125
  :ide : Ide
 
1126
 
 
1127
  let Rules0 
 
1128
  :nil  : 
 
1129
  :cons : Rule 
 
1130
          Rules0
 
1131
 
 
1132
  let Rules        ; Conflicting reduce productions, explicitly ordered
 
1133
  :cons : Rule 
 
1134
          Rules0
 
1135
 
 
1136
  let Rule
 
1137
  :red : "reduce" Ide "." Ide  ; Conflicting reduce production
 
1138
</verb>
 
1139
<p>
1072
1140
<sect2>Normalizing Productions
1073
1141
<p>
1074
 
Some of the identifiers for the production names are reserved for normalization. These are "cons", 
1075
 
"nil" and "ign(0-9)+". Beside other keywords used in the Styx grammar, you are otherwise free to 
 
1142
Some of the identifiers for the production names are reserved for normalization. These are "cons(0-9)*", 
 
1143
"nil(0-9)*" and "ign(0-9)+". Beside other keywords used in the Styx grammar, you are otherwise free to 
1076
1144
chose these names. The mentioned identifiers serve it's duty as indications of how to make up the 
1077
1145
depth grammar. A separate section is devoted to this topic. See below.
1078
1146
<p>
1156
1224
A production is well-formed if it belongs to one of the following groups:
1157
1225
<p>
1158
1226
<itemize>
1159
 
<item><tt>let X :nil  :</tt> where the production contains no (identifier)
1160
 
                             members.
1161
 
<item><tt>let X :cons : Y Z</tt> and contains exactly two (identifier) members.
1162
 
<item><tt>let X :ign# : Y</tt> where the production name starts with "ign" and
1163
 
                               continues with a natural number (that's what the
1164
 
                               "#" indicates) and the production contains exactly
1165
 
                               one (identifier) member.
1166
 
<item><tt>let X :name : X1 .. Xn</tt> where "name" is not "nil", "cons" or
1167
 
                                      starts with "ign". No restriction apply
1168
 
                                      to the production members.
 
1227
<item><tt>let X :nil#*:</tt> where the production name starts with "nil", optionally
 
1228
                             followed by a natural number, and the production contains 
 
1229
                             no (identifier) members.
 
1230
<item><tt>let X :cons#*: Y Z</tt> where the production name is "cons", optionally numbered, 
 
1231
                                  and contains exactly two (identifier) members.
 
1232
<item><tt>let X :ign#+ : Y</tt> where the production name starts with "ign"i, followed by
 
1233
                                a natural number and the production contains exactly 
 
1234
                                one (identifier) member.
 
1235
<item><tt>let X :name : X1 .. Xn</tt> where "name" does not start with "nil", "cons" or "ign". 
 
1236
                                      No restriction apply to the production members.
1169
1237
 
1170
1238
<item><em>EBNF extension (styx version >= 1.8):</em>
1171
 
<item><tt>let X :name : X1 .. Xn</tt> where "name" is not "nil", "cons", "none", "some" or
1172
 
                                      starts with "ign". No restriction apply
1173
 
                                      to the production members.
 
1239
<item><tt>let X :name : X1 .. Xn</tt> where "name" is not "none", "some" or
 
1240
                                      starts with "nil", "cons", "ign". 
 
1241
                                      No restriction apply to the production members.
1174
1242
<item><tt>let X :none :</tt> where the production contains no (identifier) members.
1175
1243
<item><tt>let X :some : Y</tt>where the production contains exactly one (identifier) member.
1176
1244
 
1177
1245
</itemize>
1178
1246
<p>
1179
1247
This grouping serves two purposes. The first two groups will be used to derive list-like productions, 
1180
 
while the "ign" production are used to define identity productions. The later typically occur with 
 
1248
while the "ign" production is used to define identity productions. The later typically occur with 
1181
1249
expressions that have different levels binding strength or when likely classes of productions are excluded 
1182
 
or included into certain contexts. When producing the abstract grammar, we consider these non-terminal to 
 
1250
or included into certain contexts. When producing the abstract grammar, we consider these non-terminals to 
1183
1251
be equivalent. 
1184
1252
<p>
1185
 
As examples, see the definitions of Exp, Exp1-2 in the introduction and Exp, Exp1-4 in the 
1186
 
lexical Styx grammar itself. For lists, the context free grammar of Styx (Dfns, Prds, Mbrs) are proper 
 
1253
As examples, see the definitions of Exp, Exp1-2 in the introduction and Exp, ExpDyck, ExpQuot, Exp0-4 in 
 
1254
the lexical Styx grammar itself. For lists, the context free grammar of Styx (Dfns, Prds, Mbrs) are proper 
1187
1255
examples.
1188
1256
<p>
1189
1257
The last two groups will be used to derive option-like productions.
1191
1259
<sect1>An induced congruence relation
1192
1260
<p>
1193
1261
We get rid of the superficial distinction between the different non-terminals by means of a congruence 
1194
 
relation over the non-terminal names induced by the special production names "cons","nil" and "ign".
 
1262
relation over the non-terminal names induced by the special production names "cons#*","nil#*" and "ign#+".
1195
1263
<p>
1196
1264
The congruence relation is defined as follows:
1197
1265
<itemize>
1198
1266
<item>X <=> X
1199
1267
<item>X <=> Y --> Y <=> X
1200
1268
<item>X <=> Y && Y <=> Z --> X <=> Z
1201
 
<item>let X :ign#: Y   --> X <=> Y
1202
 
<item>let X :cons: Y Z --> X <=> Z  
 
1269
<item>let X :ign#+: Y --> X <=> Y
 
1270
<item>let X :cons#*: Y Z --> X <=> Z  
1203
1271
<item>X <=> Y && let X :id: X1 .. Xn && let Y :id: Y1 .. Yn && 1 <= i <= n --> Xi <=> Yi
1204
1272
</itemize>
1205
1273
<p>
1241
1309
<itemize>
1242
1310
<item>X <=> Y --> Type(X) = Type(Y), where Type(Z) = { terminal, nonterminal }
1243
1311
<item>let X :id: X1 .. Xm && let Y :id: Y1 .. Yn && X <=> Y --> m = n
1244
 
<item>(let X :nil: || let X :cons: A B) --> 
1245
 
      not exists P,prod: P <=> X && let P :prod: c && prod not in { ign, nil, cons }
 
1312
<item>(let X :nil#*: || let X :cons#*: A B) --> 
 
1313
      not exists P,prod: P <=> X && let P :prod: c && prod not in { ign#+, nil#*, cons#* }
1246
1314
 
1247
1315
<item><em>EBNF extension (styx version >= 1.8):</em>
1248
1316
<item>(let X^ :none: a || let X^ :some: b)
1249
 
     --> not exists P: P = let X^ :id: c && id =/= { ign#, none, some }
 
1317
     --> not exists P: P = let X^ :id: c && id =/= { ign#+, none, some }
1250
1318
<item>(let X^ :none: a) 
1251
1319
     --> exists P: P = let X^ :some: b
1252
1320
<item>(let X^ :some: a) 
1259
1327
<p>
1260
1328
After all this preparation and conditions, we can finally convert the concrete grammar to a signature.
1261
1329
<p>
1262
 
To do this, we map all non-terminals NT which does not have list-productions (those named "cons" or "nil")
 
1330
To do this, we map all non-terminals NT which does not have list-productions (those named "cons#*" or "nil#*")
1263
1331
or - optionally - option-productions (those named "none" or "some") to their representative names NT^. 
1264
1332
Likely, all terminal names T are mapped to their representatives T^. 
1265
1333
Collectively, these form the types of the algebra.
1269
1337
the (non-)terminal names to types. The difference is, that we have to cope with list-production and - optionally -
1270
1338
option-production, which have been omitted earlier.
1271
1339
|X| is X^ if we have a non-list and - optionally - non-terminal or a terminal X. 
1272
 
If X is a non-terminal with a production "let A :cons: B C" and X <=> A, |X| is List(|B|). 
 
1340
If X is a non-terminal with a production "let A :cons#*: B C" and X <=> A, |X| is List(|B|). 
1273
1341
(If we only have nil-productions, the translation is List(void)).
1274
1342
Optionally: If X is a non-terminal with a production "let A :some: B" and X <=> A, |X| is Option(|B|). 
1275
1343
<p>
1294
1362
 
1295
1363
TYPES
1296
1364
 
1297
 
  styx        = Start_Source(Source)
1298
 
 
1299
 
  Source      = root(OptNat, Ide, QlxDfn*, OptCfg)
1300
 
 
1301
 
  OptCfg      = non;
1302
 
                cfg(Dfn*)
1303
 
 
1304
 
  QlxDfn      = mgrp(Ide, Ide*);
1305
 
                igrp(Ide);
1306
 
                defn(QlxCat, QlxOpt, QlxGrp, Ide, QlxGrp, Exp);
1307
 
                xgrp(Ide)
1308
 
 
1309
 
  QlxCat      = tokC;
1310
 
                letC;
1311
 
                indC;
1312
 
                ignC;
1313
 
                comC;
1314
 
                lanC
1315
 
 
1316
 
  QlxGrp      = pigrp;
1317
 
                pgrp(Ide);
1318
 
                grp(Ide);
1319
 
                igrp;
1320
 
                non;
1321
 
                pop
1322
 
 
1323
 
  QlxOpt      = non;
1324
 
                ignca
1325
 
 
1326
 
  Exp         = conc(Exp, Exp);
1327
 
                ident(Ide);
1328
 
                diff(Exp, Exp);
1329
 
                plusn(Exp, Limit);
1330
 
                union(Exp, Exp);
1331
 
                epat(Exp, Ide, Exp);
1332
 
                plus0(Exp);
1333
 
                sequ(Seq);
1334
 
                non;
1335
 
                quot(Exp, Exp);
1336
 
                spat(Exp, Set, Exp);
1337
 
                dyck(Exp, Exp, Exp);
1338
 
                set(Set);
1339
 
                opt(Exp);
1340
 
                plus(Exp);
1341
 
                star(Exp);
1342
 
                range(Exp, Exp)
1343
 
 
1344
 
  OptNat      = nat(Nat);
1345
 
                non
1346
 
 
1347
 
  Limit       = ntime(Nat);
1348
 
                range(Nat, OptNat)
1349
 
 
1350
 
  Dfn         = defn(Cat, DfnOpt, Ide, Prd*)
1351
 
 
1352
 
  Cat         = bgnC;
1353
 
                letC
1354
 
 
1355
 
  DfnOpt      = non;
1356
 
                errnt
1357
 
 
1358
 
  Lay         = rec;
1359
 
                dft;
1360
 
                grp
1361
 
 
1362
 
  Prd         = prod(Lay, Ide, Mbr*)
1363
 
 
1364
 
  Mbr         = tkm(Seq);
1365
 
                klst0(Seq*, Mbr, Seq*, Seq*);
1366
 
                else;
1367
 
                klst1(Seq*, Mbr, Seq*, Seq*);
1368
 
                opt(Seq*, Mbr, Seq*);
1369
 
                ntm(Ide)
 
1365
  styx          = Start_Source(Source)
 
1366
 
 
1367
  Source        = root(OptNat, Ide, QlxDfn*, OptCfg)
 
1368
 
 
1369
  OptCfg        = non;
 
1370
                  cfg(Dfn*, Conflict*)
 
1371
 
 
1372
  QlxDfn        = defd(Ide);
 
1373
                  defn(QlxCat, QlxOpt, QlxGrp, Ide, QlxGrp, Exp);
 
1374
                  igrp(Ide);
 
1375
                  tgrp(Ide);
 
1376
                  mgrp(Ide, Ide*);
 
1377
                  xgrp(Ide)
 
1378
 
 
1379
  QlxCat        = comC;
 
1380
                  indC;
 
1381
                  letC;
 
1382
                  tokC;
 
1383
                  lanC;
 
1384
                  ignC
 
1385
 
 
1386
  QlxGrp        = non;
 
1387
                  pigrp;
 
1388
                  pop;
 
1389
                  igrp;
 
1390
                  pgrp(Ide);
 
1391
                  grp(Ide)
 
1392
 
 
1393
  QlxOpt        = ignca;
 
1394
                  non
 
1395
 
 
1396
  Exp           = conc(Exp, Exp);
 
1397
                  diff(Exp, Exp);
 
1398
                  sequ(Seq);
 
1399
                  plusn(Exp, Limit);
 
1400
                  plus0(Exp);
 
1401
                  dyck(Exp, Exp, Exp);
 
1402
                  non;
 
1403
                  opt(Exp);
 
1404
                  range(Exp, Exp);
 
1405
                  plus(Exp);
 
1406
                  epat(Exp, Ide, Exp);
 
1407
                  set(Set);
 
1408
                  union(Exp, Exp);
 
1409
                  quot(Exp, Exp);
 
1410
                  ident(Ide);
 
1411
                  star(Exp);
 
1412
                  spat(Exp, Set, Exp)
 
1413
 
 
1414
  OptNat        = non;
 
1415
                  nat(Nat)
 
1416
 
 
1417
  Limit         = range(Nat, OptNat);
 
1418
                  ntime(Nat)
 
1419
 
 
1420
  Dfn           = defn(Cat, DfnOpt, Ide, Prd*)
 
1421
 
 
1422
  Cat           = letC;
 
1423
                  bgnC
 
1424
 
 
1425
  DfnOpt        = non;
 
1426
                  errnt
 
1427
 
 
1428
  Lay           = grp;
 
1429
                  rec;
 
1430
                  dft
 
1431
 
 
1432
  Prd           = prod(Lay, Ide, Mbr*)
 
1433
 
 
1434
  Mbr           = opt(Seq*, Mbr, Seq*);
 
1435
                  dtok(Ide, Ide);
 
1436
                  klst1(Seq*, Mbr, Seq*, Seq*);
 
1437
                  tkm(Seq);
 
1438
                  ntm(Ide);
 
1439
                  klst0(Seq*, Mbr, Seq*, Seq*);
 
1440
                  else
 
1441
 
 
1442
  Conflict      = defn(State, Token, Rule*)
 
1443
 
 
1444
  State         = nat(Nat);
 
1445
                  ide(Ide);
 
1446
                  seq(Seq)
 
1447
 
 
1448
  Token         = seq(Seq);
 
1449
                  ide(Ide)
 
1450
 
 
1451
  Rule          = red(Ide, Ide)
1370
1452
 
1371
1453
</verb>
1372
1454
<p>
1688
1770
<sect2>Productions for Lists
1689
1771
<p>
1690
1772
The grammar finally ends with the syntax of several lists that were
1691
 
previously used. Notice the occurrence of 'cons' and 'nil' productions,
 
1773
previously used. Notice the occurrence of "cons" and "nil" productions,
1692
1774
which hint the grammar abstractor.
1693
1775
<p>
1694
1776
<verb>
2651
2733
 
2652
2734
<sect1>Unicode support
2653
2735
<p>
2654
 
The Styx scanner &amp; parser generator should be able to deal with
 
2736
The Styx scanner &amp; parser generator is able to deal with
2655
2737
unicode based language definitions and scan streams. Since version 1.5 
2656
 
each of the released programs support unicode. This capability was added 
2657
 
later and isn't yet tested very well.
 
2738
each of the released programs support unicode. 
2658
2739
<p>
2659
2740
First you have to design the proper grammar. Styx itself doesn't
2660
2741
accept unicode specifications. You define <ref id="unicode literals" name="unicode tokens and keywords">
3034
3115
with the <ref id="styx program" name="'styx' program">. The C++ runtime scanner and parse table classes provide 
3035
3116
methods to import the exported tables.
3036
3117
<p>
3037
 
Note, that there are some restrictions regarding the Styx grammar specification. The following features won't be 
3038
 
supported by the C++ runtime system:
 
3118
Note, that there are some restrictions regarding the Styx grammar specification. For now, the following features 
 
3119
won't be supported by the C++ runtime system:
3039
3120
  <itemize>
3040
3121
  <item><ref id="indended languages" name="Indended languages">
3041
3122
  <item><ref id="embedded languages" name="Embedded languages">
 
3123
  <item><ref id="dynamic tokens" name="Dynamic tokens">
3042
3124
  </itemize>
3043
3125
<p>
3044
3126
Further, there won't be a generated C++ interface to the abstract syntax tree. You have to use the generic C++ 
3054
3136
<sect2>C# Runtime system
3055
3137
<p>
3056
3138
The source distribution of version 1.7.6 comes with a C# runtime library.
3057
 
For now, the C# library contains the module 'StyxScanner.cs' for the construction of scanners. In order to use it with a Styx grammar,
3058
 
you first have to specify the grammar and export the scanner with the <ref id="styx program" name="'styx' program">. 
 
3139
For now, the C# library contains the module 'StyxScanner.cs' for the construction of scanners. In order to use it with 
 
3140
a Styx grammar, you first have to specify the grammar and export the scanner with the <ref id="styx program" name="'styx' program">. 
3059
3141
The C# runtime scanner classes provide methods to import the exported scanner table.
3060
3142
<p>
3061
3143
Similar to the basic Styx system the C# runtime system provides a scanner test program 'StyxScannerTest',
3076
3158
  <p>
3077
3159
  <itemize>
3078
3160
  <item>Mostly disadvantages of the scanner:
3079
 
        Irregular lexical syntaxes as used in many languages
 
3161
        Some irregular lexical syntaxes as used in languages
3080
3162
        cannot be scanned. Take Rpg, Fortran or Cobol with
3081
3163
        their columnar lexical syntax as examples.
3082
3164
  <item>The parser only supports a one-symbol look-ahead,
3089
3171
        and context-dependent grammar (many do), cannot be
3090
3172
        parsed without extra tricks. Take the "typedef"
3091
3173
        declaration of C together with the application of
3092
 
        the type name in type denotations as example. Likely
3093
 
        examples are languages with definable operator
 
3174
        the type name in type denotations as example. 
 
3175
        Likely examples are languages with definable operator
3094
3176
        precedences as Algol98 or Prolog for instance.
3095
 
        Styx provides a few hooks to cope with stuff like this.
 
3177
        Styx provides a few hooks to cope with stuff like this,
 
3178
        since version 2.0.1 the usage of "dynamic" tokens to 
 
3179
        solve the first mentioned problem.
3096
3180
  </itemize>
3097
3181
 
3098
3182
<sect1>Intensive grammar abstractions
3137
3221
        derivation tree to the expense that keywords and comments
3138
3222
        are as well lost as source file references.
3139
3223
  <item>It is a plug-in replacement.
3140
 
  <item>This format originated as a workaround of some disabilities
 
3224
  <item>This format originated as a workaround for some disabilities
3141
3225
        in older versions of Microsoft's memory allocation library.
3142
3226
  </itemize>
3143
3227
 
3310
3394
<p>
3311
3395
<sect1>Styx based example applications
3312
3396
<p>
 
3397
In order to use the XML parser library you must install the source distribution.
 
3398
<p>
3313
3399
<label id="XML parser example">
3314
3400
<sect2>XML parser
3315
3401
<p>