27 March 2000 Release 2.22 Notes for New Users of PCCTS Version 1.33MR22
12
Ambiguity Aid (-ck 2 -aa 1 -aad 2)
Choice 1: rab/1 line 1 file look.g
Choice 2: rab/2 line 2 file look.g
Intersection of lookahead[1] sets:
J
Intersection of lookahead[2] sets:
X
Choice:1 Depth:1 Group:1 (J)
This is at depth 1 (match J, the first token,). The first choice starts at line 1 and flows
into rule a at line 4 (items 1 and 2). It matches J at line 4.
1 to a rab/1 line 1 look.g
2 a a/1 line 4 look.g
3 #token J a/1 line 4 look.g
Choice:2 Depth:1 Group:2 (J)
This is at depth 1 (match J, the first token). The second choice starts at line 2 and
flows into rule b at line 6 (items 1 and 2). It matches J at line 6.
1 to b rab/2 line 2 look.g
2 b b/1 line 6 look.g
3 #token J b/1 line 6 look.g
Choice:1 Depth:2 Group:3 (J X)
Choice 1 at depth2 finds a match to the second token of lookahead (X) at line 4 of rule
a. Note that it follows the same path of references as choice 1 at depth 1.
1 to a rab/1 line 1 look.g
2 a a/1 line 4 look.g
3 #token J a/1 line 4 look.g
4 #token X a/1 line 4 look.g
Choice:2 Depth:2 Group:4 (K X)
Choice 2 at depth 2 finds a match to the second token of lookahead (X) at line 7 of rule
b. Note that the first lookahead token is not J, but K. Nonetheless, this explains why
there is a collision for X which prevents linear lookahead from resolving the
ambiguity.
1 to b rab/2 line 2 look.g
2 b b/1 line 6 look.g
3 #token K b/2 line 7 look.g
4 #token X b/2 line 7 look.g
The search at depth 1 shows how both alternatives find the token J in the first token lookahead set. The search at
depth 2 shows how both alternatives find the token X in the second token lookahead set.
When ambiguity aid is enabled and an ambiguity is found in a rule or line number that matches the command line
argument the ambiguity aid routine traverses the rules using the same routines which compute first sets. It searches
for tokens which appear in the ambiguity set with appropriate depth. When it finds a match it reports the chain of
rules that were traversed to reach the point at which the match occurs.