A translation is provided when the resulting scrap is not merely a juxtaposition of the scraps it comes from. An asterisk* next to a scrap means that its first identifier gets an underlined entry in the index, via the function |make_underlined|. Two asterisks** means that both |make_underlined| and |make_reserved| are called; that is, the identifier's ilk becomes |raw_int|. A dagger before the production number refers to the notes at the end of this section, which deal with various exceptional cases.
We use
in,
out,
back and
bsp as shorthands for |indent|, |outdent|, |backup| and
|break_space|, respectively.
=4pt
=0
=2.5in
& LHS & RHS Translation & Example
&
any
any
any
any
any
any
|insert| &
any
any
any
any
any
any
& stmt; /* comment */
& |exp| |lbrace| |int_like| |decl|
& |fn_decl| |lbrace| |int_like| |decl|
F = E* | in| | in| &
main(){
main
(
ac,
av) &int
ac;
& |exp| |unop| & |exp| & |x++|
& |exp| |binop| |unorbinop| |exp| & |exp| & |x/y| |x+y|
& |exp| |comma| |exp| & |exp|
EC | opt| 9 E& |f(x,y)|
& |exp| |exp| |cast| & |exp| & |time()|
& |exp| |semi| & |stmt| & |x=0;|
& |exp| |colon| & |tag| E*C & |found:|
& |exp| |base| |int_like| |comma| & |base| B&̇nbsp;IC |opt|9
& &D : &C,
& |exp| |base| |int_like| |lbrace| & |exp| |lbrace|
E = E&̇nbsp;B&̇nbsp;I & &D : &C {
& |exp| |rbrace| & |stmt| |rbrace| & end of &enum list
& |lpar| |exp| |unorbinop| |rpar| & |exp| & |(x)| |(*)|
& |lpar| |rpar| & |exp| L˙
, R & functions, declarations
& |lpar| |decl_head| |int_like| |rpar| & |cast| & |(char*)|
& |lpar| |decl_head| |int_like| |exp| |comma| & |lpar|
L D I E C |opt|9 & |(int,|
& |lpar| |stmt| |decl| & |lpar| LS&̇nbsp; LD&̇nbsp; &
|(k=5;| |(int k=5;|
& |question| |exp| |colon| & |binop| & |?x:|
& |unop| |exp| |int_like| & |exp| |int_like| &
|!x| | |&C
& |unorbinop| |exp| |int_like| & |exp| |int_like|
İ<>U˙E & |*x|
& |unorbinop| |binop| & |binop|
| mathrel| Uİ<>B˙}̇ & |*=|
& |binop| |binop| & |binop|
| mathrel| İ<>B1˙İ<>B2˙}̇ & |»=|
& |cast| |exp| & |exp| C&̇nbsp;E & |(double)x|
& |cast| |semi| & |exp| |semi| & |(int);|
& |sizeof_like| |cast| & |exp| & |sizeof (double)|
& |sizeof_like| |exp| & |exp| S&̇nbsp;E & |sizeof x|
& |int_like| |int_like| |struct_like| &
|int_like| |struct_like| I&̇nbsp;I S
& |extern char|
& |int_like| |exp| |raw_int| |struct_like| &
|int_like| |int_like| |struct_like| & |extern "Ada" int|
& |int_like| |exp| |unorbinop| |semi| & |decl_head|
|exp| |unorbinop| |semi|
D = I˙ ˙ & |int x|
& |int_like| |colon| & |decl_head| |colon| D = I&̇nbsp; & |unsigned:|
& |int_like| |prelangle| & |int_like| |langle| & &C〈
& |int_like| |colcol| |exp| |int_like| & |exp| |int_like| &
&Cx &C&B
& |int_like| |cast| |lbrace| & |fn_decl| |lbrace|
IC | in| | in|&
&C
〈&void * 〉{
& |int_like| |cast| & |int_like| & &C
〈&class &T〉
& |decl_head| |comma| & |decl_head| DC&̇nbsp; & |int x,|
& |decl_head| |unorbinop| & |decl_head|
Dİ<>U˙ & |int *|
by1 & |decl_head| |exp| & |decl_head| DE* & |int x|
& |decl_head| |binop| |colon| |exp| |comma| |semi| |rpar| &
|decl_head| |comma| |semi| |rpar|
D = DB C E & initialization fields or
default argument
& |decl_head| |cast| & |decl_head| & |int f(int)|
by1 & |decl_head| |int_like| |lbrace| |decl| & |fn_decl|
|int_like| |lbrace| |decl|
F = D | in| | in|
& |long time () |
& |decl_head| |semi| & |decl| & |int n;|
& |decl| |decl| & |decl|
D | force| D & |int n;double x;|
& |decl| |stmt| |function| & |stmt| |function|
D | bigforce| S F & &extern n;
main ()||
by1 & |typedef_like| |decl_head| |exp| |int_like| &
|typedef_like| |decl_head| D = DE** I** &
&typedef &char &ch;
& |typedef_like| |decl_head| |semi| & |decl| T&̇nbsp;D &
&typedef &int &x,&y;
& |struct_like| |lbrace| & |struct_head| S&̇nbsp;L & |struct |
& |struct_like| |exp| |int_like| |semi| & |decl_head|
S&̇nbsp;E** I** & &struct &forward;
& |struct_like| |exp| |int_like| |lbrace| & |struct_head|
S&̇nbsp;E** I** &̇nbsp;L &
&struct &name_info {
& |struct_like| |exp| |int_like| |colon| &
|struct_like| |exp| |int_like| |base| & |class| &C :
by1 & |struct_like| |exp| |int_like| & |int_like|
S&̇nbsp;E I & &struct &name_info z;
& |struct_head| |decl| |stmt| |function| |rbrace| & |int_like|
S
in | force| D
out | force| R &
|struct | declaration ||
& |struct_head| |rbrace| & |int_like|S˙
, R & |class C|
& |fn_decl| |decl| & |fn_decl|
F | force| D
& f (z) &double z;
& |fn_decl| |stmt| & |function|
F | out| | out| | force| S
&
main() ...
& |function| |stmt| |decl| |function| & |stmt| |decl| |function|
F | bigforce| S D F & outer block
& |lbrace| |rbrace| & |stmt| L˙
, R & empty statement
35pt
& |lbrace| |stmt| |decl| |function| |rbrace| & |stmt|
| force| L
in | force| S | force|
back R
out | force| & compound statement
-20pt
& |lbrace| |exp| [|comma|] |rbrace| & |exp| & initializer
& |if_like| |exp| & |if_clause| I&̇nbsp;E & |if (z)|
& |for_like| |exp| & |else_like| F&̇nbsp;E & |while (1)|
& |else_like| |lbrace| & |else_head| |lbrace| & &else {
& |else_like| |stmt| & |stmt|
| force| E
in
bsp S
out | force| & |else x=0;|
& |else_head| |stmt| |exp| & |stmt|
| force| E
bsp | noop| | cancel| S
bsp & |elsex=0;|
& |if_clause| |lbrace| & |if_head| |lbrace| & |if (x) |
& |if_clause| |stmt| |else_like| |if_like| & |if_like|
| force| I
in
bsp S
out | force| E &̇nbsp;I &
|if (x) y; else if|
& |if_clause| |stmt| |else_like| & |else_like|
| force| I
in
bsp S
out | force| E &
|if (x) y; else|
& |if_clause| |stmt| & |else_like| |stmt| & |if (x)|
& |if_head| |stmt| |exp| |else_like| |if_like| & |if_like|
| force| I
bsp | noop| | cancel| S | force| E &̇nbsp;I &
|if (x)y;else if|
& |if_head| |stmt| |exp| |else_like| & |else_like|
| force| I
bsp | noop| | cancel| S | force| E &
|if (x)y;else|
& |if_head| |stmt| |exp| & |else_head| |stmt| |exp| & |if (x)y;|
20pt
& |do_like| |stmt| |else_like| |semi| & |stmt|
D
bsp | noop| | cancel| S | cancel| | noop|
bsp ES& |do f(x); while (g(x));|
-20pt
& |case_like| |semi| & |stmt| & |return;|
& |case_like| |colon| & |tag| & |default:|
& |case_like| |exp| |semi| & |stmt| C&̇nbsp;ES & |return 0;|
& |case_like| |exp| |colon| & |tag| C&̇nbsp;EC & |case 0:|
& |tag| |tag| & |tag|
T1
bsp T2 & |case 0: case 1:|
& |tag| |stmt| |decl| |function| & |stmt| |decl| |function|
| force|
back T
bsp S & |case 0: z=0;|
by1 & |stmt| |stmt| |decl| |function| &
|stmt| |decl| |function|
S
| force| S
| bigforce| D
| bigforce| F &
|x=1;y=2;|
& |semi| & |stmt| ˙ S& empty statement
by1 & |lproc| |if_like| |else_like| |define_like| & |lproc| &
#include #else #define
& |lproc| |rproc| & |insert| & #endif
& |lproc| |exp| [|exp|] |function| |rproc| & |insert|
I˙
E[&̇nbsp;
5E] F &
#define a 1 #define a
{ b; }
& |section_scrap| |semi| & |stmt|MS |force|
&〈 section name 〉;
& |section_scrap| & |exp| &〈 section name 〉
& |insert| |any| & |any| & &̇#124;#include|
& |prelangle| & |binop| < & < not in template
& |prerangle| & |binop| > & > not in template
& |langle| |exp| |prerangle| & |cast| &
〈 0 〉
& |langle| |prerangle| & |cast| L˙
, P &
〈 〉
& |langle| |decl_head| |int_like| |prerangle| & |cast| &
〈&class &C〉
& |langle| |decl_head| |int_like| |comma| & |langle|
L D I C |opt|9 &
〈&class &C,
& |public_like| |colon| & |tag| & &private:
& |public_like| & |int_like| & &private
& |colcol| |exp| |int_like| & |exp| |int_like| & |::x|
by1 &
|new_like| |exp| |raw_int| & |new_like| N&̇nbsp;E & |new(1)|
& |new_like| |raw_unorbin| |colcol| & |new_like| & |new ::*|
& |new_like| |cast| & |exp| & |new(*)|
by1 & |new_like| & |exp| & |new|
by1 & |operator_like| |binop| |unop| |unorbinop| & |exp|
O˙{B U U˙} & |operator+|
& |operator_like| |new_like| |sizeof_like| & |exp| O&̇nbsp;N
& |operator delete|
& |operator_like| & |new_like| & conversion operator
& |catch_like| |cast| |exp| & |fn_decl|
CE
in
in &
|catch (...)|
& |base| |public_like| |exp| |comma| & |base| BP&̇nbsp;EC &
: &public a,
& |base| |public_like| |exp| & |base| |int_like| I = P&̇nbsp;E &
: &public a
& |raw_rpar| |const_like| & |raw_rpar| R&̇nbsp;C & ) &const;
& |raw_rpar| & |rpar| & );
& |raw_unorbin| |const_like| & |raw_unorbin| RCḂ
Rule 38: The |int_like| must not be immediately followed by |colcol|.
Rule 42: The |exp| must not be immediately followed by |lpar| or |exp|.
Rule 48: The |exp| or |int_like| must not be immediately followed by |base|.
Rule 76: The |force| in the |stmt| line becomes
bsp if ĊWEAVE has
been invoked with the -̇f option.
Rule 78: The |define_like| case calls |make_underlined| on the following scrap.
Rule 93: The |raw_int| must not be immediately followed by |prelangle| or |langle|.
Rule 96: The |new_like| must not be immediately followed by |lpar|, |raw_int|, or |struct_like|.
Rule 97: The operator after |operator_like| must not be immediately followed by a |binop|.