forked from alan2lin/hand_in_hand_with_antlr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hand in hand with antlr.htm
3580 lines (2907 loc) · 218 KB
/
hand in hand with antlr.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=Generator content="Microsoft Word 12 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:微软雅黑;
panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@微软雅黑";
panose-1:2 11 5 3 2 2 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
h1
{mso-style-link:"标题 1 Char";
margin-top:24.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:21.25pt;
margin-bottom:.0001pt;
text-indent:-21.25pt;
line-height:115%;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria","serif";
color:#365F91;}
h2
{mso-style-link:"标题 2 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:49.6pt;
margin-bottom:.0001pt;
text-indent:-1.0cm;
line-height:115%;
page-break-after:avoid;
font-size:13.0pt;
font-family:"Cambria","serif";
color:#4F81BD;}
h3
{mso-style-link:"标题 3 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:70.9pt;
margin-bottom:.0001pt;
text-indent:-1.0cm;
line-height:115%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#4F81BD;}
h4
{mso-style-link:"标题 4 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:99.2pt;
margin-bottom:.0001pt;
text-indent:-35.4pt;
line-height:115%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#4F81BD;
font-style:italic;}
h5
{mso-style-link:"标题 5 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
line-height:115%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#243F60;
font-weight:normal;}
h6
{mso-style-link:"标题 6 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
line-height:115%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#243F60;
font-weight:normal;
font-style:italic;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
{mso-style-link:"标题 7 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
line-height:115%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#404040;
font-style:italic;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
{mso-style-link:"标题 8 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
line-height:115%;
page-break-after:avoid;
font-size:10.0pt;
font-family:"Cambria","serif";
color:#4F81BD;}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
{mso-style-link:"标题 9 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
line-height:115%;
page-break-after:avoid;
font-size:10.0pt;
font-family:"Cambria","serif";
color:#404040;
font-style:italic;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:21.0pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:42.0pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{mso-style-link:"页眉 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-align:center;
line-height:115%;
layout-grid-mode:char;
border:none;
padding:0cm;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{mso-style-link:"页脚 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
layout-grid-mode:char;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
p.MsoCaption, li.MsoCaption, div.MsoCaption
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
font-size:9.0pt;
font-family:"Calibri","sans-serif";
color:#4F81BD;
font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
{mso-style-link:"标题 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:15.0pt;
margin-left:0cm;
border:none;
padding:0cm;
font-size:26.0pt;
font-family:"Cambria","serif";
color:#17365D;
letter-spacing:.25pt;}
p.MsoTitleCxSpFirst, li.MsoTitleCxSpFirst, div.MsoTitleCxSpFirst
{mso-style-link:"标题 Char";
margin:0cm;
margin-bottom:.0001pt;
border:none;
padding:0cm;
font-size:26.0pt;
font-family:"Cambria","serif";
color:#17365D;
letter-spacing:.25pt;}
p.MsoTitleCxSpMiddle, li.MsoTitleCxSpMiddle, div.MsoTitleCxSpMiddle
{mso-style-link:"标题 Char";
margin:0cm;
margin-bottom:.0001pt;
border:none;
padding:0cm;
font-size:26.0pt;
font-family:"Cambria","serif";
color:#17365D;
letter-spacing:.25pt;}
p.MsoTitleCxSpLast, li.MsoTitleCxSpLast, div.MsoTitleCxSpLast
{mso-style-link:"标题 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:15.0pt;
margin-left:0cm;
border:none;
padding:0cm;
font-size:26.0pt;
font-family:"Cambria","serif";
color:#17365D;
letter-spacing:.25pt;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
{mso-style-link:"副标题 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
font-size:12.0pt;
font-family:"Cambria","serif";
color:#4F81BD;
letter-spacing:.75pt;
font-style:italic;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
pre
{mso-style-link:"HTML 预设格式 Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:宋体;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-link:"批注框文本 Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:36.0pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:36.0pt;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
p.MsoQuote, li.MsoQuote, div.MsoQuote
{mso-style-link:"引用 Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
font-size:12.0pt;
font-family:"Calibri","sans-serif";
color:black;
font-style:italic;}
p.MsoIntenseQuote, li.MsoIntenseQuote, div.MsoIntenseQuote
{mso-style-link:"明显引用 Char";
margin-top:10.0pt;
margin-right:46.8pt;
margin-bottom:14.0pt;
margin-left:46.8pt;
line-height:115%;
border:none;
padding:0cm;
font-size:12.0pt;
font-family:"Calibri","sans-serif";
color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.MsoSubtleEmphasis
{color:gray;
font-style:italic;}
span.MsoIntenseEmphasis
{color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.MsoSubtleReference
{font-variant:small-caps;
color:#C0504D;
text-decoration:underline;}
span.MsoIntenseReference
{font-variant:small-caps;
color:#C0504D;
letter-spacing:.25pt;
font-weight:bold;
text-decoration:underline;}
span.MsoBookTitle
{font-variant:small-caps;
letter-spacing:.25pt;
font-weight:bold;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{margin-top:24.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:21.25pt;
margin-bottom:.0001pt;
text-indent:-21.25pt;
line-height:115%;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.Char
{mso-style-name:"页眉 Char";
mso-style-link:页眉;}
span.Char0
{mso-style-name:"页脚 Char";
mso-style-link:页脚;}
span.1Char
{mso-style-name:"标题 1 Char";
mso-style-link:"标题 1";
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.2Char
{mso-style-name:"标题 2 Char";
mso-style-link:"标题 2";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.3Char
{mso-style-name:"标题 3 Char";
mso-style-link:"标题 3";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.4Char
{mso-style-name:"标题 4 Char";
mso-style-link:"标题 4";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.5Char
{mso-style-name:"标题 5 Char";
mso-style-link:"标题 5";
font-family:"Cambria","serif";
color:#243F60;}
span.6Char
{mso-style-name:"标题 6 Char";
mso-style-link:"标题 6";
font-family:"Cambria","serif";
color:#243F60;
font-style:italic;}
span.7Char
{mso-style-name:"标题 7 Char";
mso-style-link:"标题 7";
font-family:"Cambria","serif";
color:#404040;
font-style:italic;}
span.8Char
{mso-style-name:"标题 8 Char";
mso-style-link:"标题 8";
font-family:"Cambria","serif";
color:#4F81BD;}
span.9Char
{mso-style-name:"标题 9 Char";
mso-style-link:"标题 9";
font-family:"Cambria","serif";
color:#404040;
font-style:italic;}
span.Char1
{mso-style-name:"标题 Char";
mso-style-link:标题;
font-family:"Cambria","serif";
color:#17365D;
letter-spacing:.25pt;}
span.Char2
{mso-style-name:"副标题 Char";
mso-style-link:副标题;
font-family:"Cambria","serif";
color:#4F81BD;
letter-spacing:.75pt;
font-style:italic;}
span.Char3
{mso-style-name:"引用 Char";
mso-style-link:引用;
color:black;
font-style:italic;}
span.Char4
{mso-style-name:"明显引用 Char";
mso-style-link:明显引用;
color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.Char5
{mso-style-name:"批注框文本 Char";
mso-style-link:批注框文本;}
span.HTMLChar
{mso-style-name:"HTML 预设格式 Char";
mso-style-link:"HTML 预设格式";
font-family:宋体;}
span.apple-style-span
{mso-style-name:apple-style-span;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.langwithname
{mso-style-name:langwithname;}
.MsoChpDefault
{font-size:11.0pt;}
.MsoPapDefault
{margin-bottom:10.0pt;
line-height:115%;}
/* Page Definitions */
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
/* List Definitions */
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US
style='font-size:18.0pt;line-height:115%;font-family:宋体'>林氏物语</span><span
lang=EN-US style='font-size:18.0pt;line-height:115%'>.</span><span
style='font-size:18.0pt;line-height:115%;font-family:宋体'>技术乱弹</span><span
lang=EN-US style='font-size:18.0pt;line-height:115%;font-family:宋体'>之</span><span
lang=EN-US style='font-size:18.0pt;line-height:115%'>hand in hand </span><span
lang=EN-US style='font-size:18.0pt;line-height:115%'>with </span><span
lang=EN-US style='font-size:18.0pt;line-height:115%'>antlr</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>版权声明:</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US> </span><span
style='font-family:宋体'>本文由林氏原创,遵循</span><span lang=EN-US>GPL</span><span
style='font-family:宋体'>许可,你可以自由地对本文进行任何目的的修改、转载、引用和发布,但基于此文所作的任何修改、转载、引用和发布品也需要遵循</span><span
lang=EN-US>GPL</span><span style='font-family:宋体'>许可,并要求在开头保留本声明。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>联系作者:如果您有什么样的批评与指教,欢迎发</span><span
lang=EN-US>email</span><span style='font-family:宋体'>到</span><span lang=EN-US>
[email protected];</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='font-family:宋体'>如需获取最新的更新,请在</span><span lang=EN-US>email</span><span
lang=EN-US style='font-family:宋体'>的</span><span lang=EN-US>subject</span><span
lang=EN-US style='font-family:宋体'>填写</span><span lang=EN-US>get 010</span><span
lang=EN-US>4</span><span lang=EN-US>0</span><span lang=EN-US>2</span><span
lang=EN-US>00</span><span lang=EN-US>1</span><span lang=EN-US style='font-family:
宋体'>发送至</span><span lang=EN-US> [email protected];</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='font-family:宋体'>如需获取林氏物语系列文章的列表,请在</span><span lang=EN-US>email</span><span
lang=EN-US style='font-family:宋体'>的</span><span lang=EN-US>subject</span><span
lang=EN-US style='font-family:宋体'>填写</span><span lang=EN-US>get list</span><span
lang=EN-US style='font-family:宋体'>发送至</span><span lang=EN-US>:</span><span
lang=EN-US>[email protected];</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>如需获取林氏物语系列文章,请在</span><span
lang=EN-US>email</span><span style='font-family:宋体'>的</span><span lang=EN-US>subject</span><span
style='font-family:宋体'>填写</span><span lang=EN-US>get all</span><span
style='font-family:宋体'>发送至</span><span lang=EN-US>:[email protected];</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US> </span><span
style='font-family:宋体'>由于没有自己的邮件服务器,没有找到带附件自动回复的免费邮件服务器,采用客户端带附件自动回复,所以是非即时性回复,最迟回复时间尽量不超过一周,请勿发送多次。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US>l </span><span
style='font-family:宋体'>本文编号</span><span lang=EN-US>:010402001</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US>l </span><span
style='font-family:宋体'>所属文集</span><span lang=EN-US>:</span><span
style='font-family:宋体'>林氏物语</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US>l </span><span
style='font-family:宋体'>所属类别</span><span lang=EN-US>:</span><span
style='font-family:宋体'>技术乱弹</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US>l </span><span
style='font-family:宋体'>所属细类</span><span lang=EN-US>:</span><span
style='font-family:宋体'>编译原理</span> </p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US> </span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364002991"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第一章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>前言</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>3</span></a></span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364002992"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第二章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>安装篇</span></span>:<span
style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>4</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364002993"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第一节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>安装前的检查</span></span>:<span
style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>4</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364002994"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>是否已经安装了</span></span>java
1.5 <span lang=EN-US style='font-family:宋体'><span lang=EN-US>或<span lang=EN-US>者更高的版本。</span></span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>4</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364002995"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>是否已经下载了</span></span>eclipse
3.x.<span style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>4</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364002996"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>3<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>建立本教程演示目录。</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>5</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364002997"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第二节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>安装过程</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>6</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364002998"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>下载</span></span>antworks<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>:</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>6</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364002999"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>下载</span></span>antlr<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>的</span></span>jar<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>包</span></span><span
lang=EN-US><span lang=EN-US> </span></span><span lang=EN-US style='font-family:
宋体'><span lang=EN-US>当前的版本是</span></span> v3.3<span style='color:windowtext;
display:none;text-decoration:none'>. </span><span
style='color:windowtext;display:none;text-decoration:none'>7</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003000"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>3<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>安装</span></span>eclipse<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>插件。</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>8</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003001"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>4<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>确认你的安装是否正确。</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>11</span></a></span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364003002"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第三章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>工具环境介绍篇:</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>12</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003003"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第一节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>先从</span></span>antlrworks<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>开始体验</span></span>antlr.<span
style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>13</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003004"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>创<span lang=EN-US>建语法文件</span></span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>13</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003005"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>运行调试语法文件</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>15</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003006"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第二节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>再开始品尝</span></span>anltrv3ide<span
style='color:windowtext;display:none;text-decoration:none'>. </span><span
style='color:windowtext;display:none;text-decoration:none'>18</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003007"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>新建一个</span></span>antlr<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>项目</span></span>.<span
style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>18</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003008"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>创建语法文件</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>19</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003009"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>3<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>进行或者检查插件的设置</span></span>..<span
style='color:windowtext;display:none;text-decoration:none'> </span><span
style='color:windowtext;display:none;text-decoration:none'>23</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003010"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>4<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>编写测试的程序</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>26</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003011"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第三节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span>Antlrworks<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>工具的各部分使用说明</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>30</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003012"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第四节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span>Antlrv3ide<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>插件的各部分使用说明</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>31</span></a></span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364003013"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第四章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>使用篇</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>33</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003014"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第一节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>无责任乱弹</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>33</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003015"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第二节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>关于语法解析的一些基本概念</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>35</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003016"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>什么是词法分析,什么是语法分析,这两者有什么不同?</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>36</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003017"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>巴克斯</span></span>-<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>诺尔范式</span></span>,<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>产生式</span></span>,<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>最左推导</span></span>,<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>最右推导</span></span>,<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>左递归</span></span>,<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>右递归</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>38</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003018"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>3<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>语法解析的自顶向下和自底向上的策略</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>39</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003019"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第三节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>经典的表达式<span lang=EN-US>教程解析</span></span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>44</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003020"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>1<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>界定需求</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>44</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003021"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>2<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>设计语法</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>45</span></a></span></p>
<p class=MsoToc3 style='margin-left:48.0pt'><span lang=EN-US><a
href="#_Toc364003022"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第</span></span>3<span
lang=EN-US style='font-family:宋体'><span lang=EN-US>小节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>实现语义</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>50</span></a></span></p>
<p class=MsoToc2 style='margin-left:24.0pt'><span lang=EN-US><a
href="#_Toc364003023"><span lang=EN-US style='font-family:宋体'><span lang=EN-US>第四节</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>状态机代码生成框架实例分析</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>52</span></a></span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364003024"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第五章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>附录</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>52</span></a></span></p>
<p class=MsoToc1><span lang=EN-US><a href="#_Toc364003025"><span lang=EN-US
style='font-family:宋体'><span lang=EN-US>第六章</span></span><span
style='font-size:10.5pt;line-height:115%;color:windowtext;text-decoration:none'> </span><span
lang=EN-US style='font-family:宋体'><span lang=EN-US>引用</span></span><span
style='color:windowtext;display:none;text-decoration:none'>... </span><span
style='color:windowtext;display:none;text-decoration:none'>52</span></a></span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US> </span></p>
<h1><a name="_Toc364002991"><span lang=EN-US>第一章 <span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>前言</span></a></h1>
<p class=MsoNormal style='margin-left:21.25pt'><span style='font-family:宋体'>讨论组地址</span><span
lang=EN-US>: </span><span lang=EN-US><a
href="http://groups.google.com/group/antlr_chinese/">http://groups.google.com/group/antlr_chinese/</a></span></p>
<p class=MsoNormal style='margin-left:21.25pt'><span lang=EN-US> </span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>仔细数起来</span><span
lang=EN-US>,coding</span><span style='font-family:宋体'>生涯也有不少年头了</span><span
lang=EN-US>,</span><span style='font-family:宋体'>从</span><span lang=EN-US>99</span><span
style='font-family:宋体'>年到现在</span><span lang=EN-US>,</span><span
style='font-family:宋体'>虽然中途离开过几年</span><span lang=EN-US>,</span><span
style='font-family:宋体'>但始终没有停留过关注</span><span lang=EN-US>.</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>在这不长不短的岁月里</span><span
lang=EN-US>,</span><span style='font-family:宋体'>在指尖流过的语言也有不少了</span><span
lang=EN-US>,</span><span style='font-family:宋体'>从学生年代的</span><span lang=EN-US>c/cpp,object
pascal,asm,sql</span><span style='font-family:宋体'>等到工作中用过的</span><span
lang=EN-US>vbs/js,java,html,xml, schema,R,erlang</span><span style='font-family:
宋体'>和一些即兴学的</span><span lang=EN-US>shell script</span><span style='font-family:
宋体'>等,年轻时偏执于语言的表层,略显轻狂</span><span lang=EN-US>,</span><span style='font-family:
宋体'>并以之为傲。后来修习图灵机,</span><span lang=EN-US>lambda</span><span style='font-family:
宋体'>算子</span><span lang=EN-US>,</span><span style='font-family:宋体'>组合子之类的计算模型,尝试着对语言的本质做了一些深入的思考</span><span
lang=EN-US>,</span><span style='font-family:宋体'>才发觉其实自己一直都是井底之蛙。在接触了古老的</span><span
lang=EN-US>lex +yacc</span><span style='font-family:宋体'>后</span><span
lang=EN-US>,</span><span style='font-family:宋体'>为其高度抽象的简洁与优美所折服</span><span
lang=EN-US>.</span><span style='font-family:宋体'>遂不能自拔。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>一直都比较喜欢类似</span><span
lang=EN-US>lex+yacc</span><span style='font-family:宋体'>之类产生式工具,由于工作主要是</span><span
lang=EN-US>java</span><span style='font-family:宋体'>相关的</span><span lang=EN-US>,</span><span
style='font-family:宋体'>也接触了</span><span lang=EN-US>antlr.</span><span
style='font-family:宋体'>并对其保持比较浓厚的兴趣</span><span lang=EN-US>,</span><span
style='font-family:宋体'>时隔几年后重回</span><span lang=EN-US>it</span><span
style='font-family:宋体'>时</span><span lang=EN-US>,</span><span style='font-family:
宋体'>因为一个小产品的开发需要,对词法语法解析工具选型,选了几个工具,</span><span lang=EN-US>javacc </span><span
style='font-family:宋体'>,</span><span lang=EN-US>antlr </span><span
style='font-family:宋体'>,</span><span lang=EN-US>jflex+CUP</span><span
style='font-family:宋体'>,最终还是选择了</span><span lang=EN-US>antlr</span><span
style='font-family:宋体'>。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>关于工具的选择方面</span><span
lang=EN-US>. </span><span style='font-family:宋体'>一直认为</span><span lang=EN-US>,</span><span
style='font-family:宋体'>工欲善其事,必先利其器,但何为利器,如何评价,一直没有清晰的定义,有些东西,明明很好很强大,但是就是无法推广,比如基于强大</span><span
lang=EN-US>lambda</span><span style='font-family:宋体'>算子的函数式语言及其平台如</span><span
lang=EN-US>lisp </span><span style='font-family:宋体'>,</span><span lang=EN-US>schema
</span><span style='font-family:宋体'>等。很多年后,才明白,评价一个一个东西,不仅仅看点上的表现,还需要看面上的表现,比如周边的环境支撑等</span>
<span style='font-family:宋体'>,哪怕点上的表现稍逊一筹,只要面上的表现优异,也能弥补其缺陷。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>一个工具,被选择的首当其冲的标准当属于其生产能力,评价选择一个工具的生产能力,除了要看它的主要功能外,还要看它对你的生产流程的覆盖程度。覆盖的越全,也就认为其产出效率越高。凭借</span><span
lang=EN-US>eclipse</span><span style='font-family:宋体'>这个强大的工具平台。</span><span
lang=EN-US>Antlr </span><span style='font-family:宋体'>做到了从前端语法设计到调试到集成测试的无缝覆盖,这确实是我选择其的一个关键决定因素。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>贸然的使用一个不成熟的工具,或者没有实践过的新解决方案,不管它在别人那里是如何成功的,你都需要支付一定风险的。利器从来都是双刃的,伤人亦能伤己,用的好,强虏灰飞烟灭,用的不好,伤痕累累,欲罢不能。诚然,形式化的产生式编程方式如</span>
<span lang=EN-US>antlr</span><span style='font-family:宋体'>的确有其强大且简洁优雅的一面,但凡事有利必有弊,一旦遇到问题,其背后隐藏的抽象的复杂度足够让一个项目或产品栽倒在时间压力面前。这也是这个工具鲜被采用的原因。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>开发结束后</span><span
lang=EN-US>,</span><span style='font-family:宋体'>对使用这个工具所遇到的问题以及一些解决方法,作了一些总结和整理。前车之鉴,后事之师,不管是为人还是为己。于是萌生了写个文档的想法,说是写,实际上是不过是将所找的零碎资料拼装而已。在找资料的过程中发现,鲜有中文教程,只有一本</span><span
lang=EN-US>v2.75</span><span style='font-family:宋体'>的中文版规范。</span> <span
style='font-family:宋体'>虽然官方的英文文档不算少,但对于在非英语母语的我们来说,对英文信息的敏感度较低,从那堆信息里,寻找一条合适的学习路径略显艰难。于是就学习吾友陈民的做法,尽力写一些教程像他以前帮助我一样帮助其他人。另外在这里也特别感谢甘草同志</span><span
lang=EN-US>([email protected])</span><span style='font-family:宋体'>,加入这个阵营</span><span
lang=EN-US>…</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>这篇教程定位为帮助零基础的初学者入门到掌握编译前端,为熟悉</span><span
lang=EN-US>antlr</span><span style='font-family:宋体'>的人,提供一些问题备忘录,以及共享一些对</span><span
lang=EN-US>antlr</span><span style='font-family:宋体'>本身设计的看法。希望能对您有所帮助。</span></p>
<h1><a name="_Toc364002992"><span lang=EN-US>第二章 <span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>安装篇</span></a><span lang=EN-US>:</span></h1>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>选择</span><span
lang=EN-US>antlr</span><span style='font-family:宋体'>确实有很大的优势。</span> <span
style='font-family:宋体'>有官方自带的</span><span lang=EN-US>antlrworks </span><span
style='font-family:宋体'>,有</span> <span style='font-family:宋体'>民间的</span><span
lang=EN-US>antlrv3ide </span><span style='font-family:宋体'>,和</span><span
lang=EN-US> netbeans</span><span style='font-family:宋体'>什么的插件等等。还有一些收费的</span><span
lang=EN-US>eclipse</span><span style='font-family:宋体'>插件等,具体就不去细列了,这个教程主要集中在</span><span
lang=EN-US>antlrworks </span><span style='font-family:宋体'>和</span><span
lang=EN-US> antlrv3ide+eclipse</span><span style='font-family:宋体'>等两个</span><span
lang=EN-US> ide </span><span style='font-family:宋体'>上面。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>通过本篇的学习,你应该能搭建好一个可以实战的平台。</span></p>
<h2><a name="_Toc364002993"><span lang=EN-US>第一节<span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>安装前的检查</span></a><span lang=EN-US>:</span><span
lang=EN-US> </span></h2>
<h3><a name="_Toc364002994"><span lang=EN-US>第1小节<span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>是否已经安装了</span></a><span lang=EN-US>java
1.5 </span><span style='font-family:宋体'>或者更高的版本。</span> </h3>
<p class=MsoListParagraph><span style='font-family:宋体'>确认方法</span><span
lang=EN-US> java –version </span><span style='font-family:宋体'>和</span><span
lang=EN-US>javac –version</span><span style='font-family:宋体'>,如果不能工作,或者版本不对,请检查环境变量的</span><span
lang=EN-US>JAVA_HOME</span></p>
<h3><a name="_Toc364002995"><span lang=EN-US>第2小节<span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>是否已经下载了</span></a><span lang=EN-US>eclipse
3.x.</span></h3>
<p class=MsoListParagraphCxSpFirst><span style='font-family:宋体'>教程使用的是</span><span
lang=EN-US> eclipse 3.6.2(helios) </span><span lang=EN-US
style='font-size:9.0pt;line-height:115%;font-family:"微软雅黑","sans-serif"'>Eclipse
Modeling Tools</span><span lang=EN-US> </span><span style='font-family:宋体'>那个版本,最好保持和教程一致的。不能确定</span><span
lang=EN-US>antlrv3ide</span><span style='font-family:宋体'>是否适用了</span><span
lang=EN-US>gef </span><span style='font-family:宋体'>或者</span><span lang=EN-US>gmf
</span><span style='font-family:宋体'>但建议如果你使用其它的类型的</span><span lang=EN-US>eclipse
</span><span style='font-family:宋体'>,将</span><span lang=EN-US>modeling </span><span
style='font-family:宋体'>模块升级到最新版本。同时还需要安装一个</span><span lang=EN-US>dynamic
languages toolkit core frameworks.</span><span style='font-family:宋体'>这个是</span><span
lang=EN-US>antlrv3ide</span><span style='font-family:宋体'>依赖的插件</span><span
lang=EN-US>.</span><span style='font-family:宋体'>本教程所用的插件如下</span><span
lang=EN-US>:</span><span style='font-family:宋体'>(画圈圈的是没有安装插件前就要存在的。如果没有,你需要在</span><span
lang=EN-US> help->install new software </span><span style='font-family:宋体'>中选择</span><span
lang=EN-US> helios</span><span style='font-family:宋体'>这个更新源进行更新)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-left:18.0pt'><span
lang=EN-US><img border=0 width=553 height=363
src="hand%20in%20hand%20with%20antlr.files/image001.jpg"></span></p>
<p class=MsoListParagraphCxSpLast style='margin-left:18.0pt'><span lang=EN-US> </span></p>
<h3><a name="_Toc364002996"><span lang=EN-US>第3小节<span style='font:7.0pt "Times New Roman"'>
</span></span><span style='font-family:宋体'>建立本教程演示目录。</span></a></h3>
<p class=MsoListParagraphCxSpFirst><span style='font-family:宋体'>建立一个目录</span><span
lang=EN-US>(d:\antlrdemo),</span><span style='font-family:宋体'>用作本教程的演示目录,这个目录可以更换到其他的地方,<span
style='color:red'>但是请注意,请不要带有中文或者其他非英文字母</span>。</span></p>
<p class=MsoListParagraphCxSpMiddle><span style='font-family:宋体'>在</span><span
lang=EN-US>anltrdemo</span><span style='font-family:宋体'>下面建立一个</span><span
lang=EN-US>antlrworks_data</span><span style='font-family:宋体'>目录。</span></p>
<p class=MsoListParagraphCxSpMiddle><span style='font-family:宋体'>将</span><span
lang=EN-US>eclipse</span><span style='font-family:宋体'>拷贝至</span><span
lang=EN-US> antlrdemo</span><span style='font-family:宋体'>目录下。</span> </p>
<p class=MsoListParagraphCxSpLast><span style='font-family:宋体'>并在</span><span
lang=EN-US>eclipse</span><span style='font-family:宋体'>目录下建立</span> <span
style='font-family:宋体'>一个</span><span lang=EN-US>workspace</span><span
style='font-family:宋体'>的目录,并在启动</span><span lang=EN-US>eclipse</span><span
style='font-family:宋体'>的时候,将工作空间设置为这个目录的工作空间。这样做的目的便于管理资料。</span></p>
<p class=MsoNormal><span lang=EN-US><img border=0 width=271 height=305
src="hand%20in%20hand%20with%20antlr.files/image002.png"></span></p>
<p class=MsoListParagraphCxSpFirst style='margin-left:18.0pt'><span lang=EN-US> </span></p>