next up previous contents index practicapracticaPP2moodleLHPmoodlepserratacpanmodulospauseperlgoogleetsiiullpcgull
Sig: Código de Calc.output Sup: Apéndice Ant: Código de Calc.pm Err: Si hallas una errata ...


Código de aSb.output

Este apéndice muestra el fichero aSb.output resultante de traducir mediante yapp con la opción -v el programa aSb.yp:
%%
S:                 { print "S -> epsilon\n" }
    |   'a' S 'b'  { print "S -> a S b\n" }
;
%%
...
Este es el ejemplo que se usó en las secciones 14.2 y 14.3.2. Sigue el fichero aSb.output:
 1 Rules:
 2 ------
 3 0:	$start -> S $end
 4 1:	S -> /* empty */
 5 2:	S -> 'a' S 'b'
 6 
 7 States:
 8 -------
 9 State 0:
10 
11 	$start -> . S $end	(Rule 0)
12 	'a'	shift, and go to state 2
13 	$default	reduce using rule 1 (S)
14 	S	go to state 1
15 
16 State 1:
17 
18 	$start -> S . $end	(Rule 0)
19 	$end	shift, and go to state 3
20 
21 State 2:
22 
23 	S -> 'a' . S 'b'	(Rule 2)
24 	'a'	shift, and go to state 2
25 	$default	reduce using rule 1 (S)
26 	S	go to state 4
27 
28 State 3:
29 
30 	$start -> S $end .	(Rule 0)
31 	$default	accept
32 
33 State 4:
34 
35 	S -> 'a' S . 'b'	(Rule 2)
36 	'b'	shift, and go to state 5
37 
38 State 5:
39 
40 	S -> 'a' S 'b' .	(Rule 2)
41 	$default	reduce using rule 2 (S)
42 
43 
44 Summary:
45 --------
46 Number of rules         : 3
47 Number of terminals     : 3
48 Number of non-terminals : 2
49 Number of states        : 6


next up previous contents index practicapracticaPP2moodleLHPmoodlepserratacpanmodulospauseperlgoogleetsiiullpcgull
Sig: Código de Calc.output Sup: Apéndice Ant: Código de Calc.pm Err: Si hallas una errata ...
Casiano Rodríguez León
2006-02-21