编译器自动构造

当分析问题变得好懂起来时,人们就在开发程序上花费了很大的功夫来研究这一部分的编译器自动构造。

这些程序最初被称为编译器的编译器(Compiler-compiler),但更确切地应称为分析程序生成器(Parser Generator),这是因为它们仅仅能够自动处理编译的一部分。

这些程序中最著名的是Yacc(Yet Another Compiler-compiler),它是由Steve Johnson在1975年为Unix系统编写的。类似的, 有限状态自动机 的研究也发展了一种称为扫描程序生成器(Scanner Generator)的工具,Lex(与Yacc同时,由Mike Lesk为Unix系统开发)是这其中的佼佼者。

 1 package Com.Table;
 2 
 3 public class TenTable {
 4     String Name;
 5     String Color;
 6     String Age;
 7     public TenTable(String Name, String Color, String Age) {
 8         this.Name = Name;
 9         this.Color = Color;
10         this.Age = Age;
11     }
12  
13     void ShowDog()
14     {
15         System.out.println("This dog name " + Name + "," + Color + " color," + Age + " age.");
16     }
17  
18     public static void main(String []args)
19     {
20         TenTable Dog = new TenTable("dollar", "white", "four");
21         Dog.ShowDog();
22     }
23 }
原文地址:https://www.cnblogs.com/borter/p/9384278.html