Yacc : Yet Another Compiler-Compiler 中英对照1

Yacc: Yet Another Compiler-Compiler


Stephen C. Johnson
AT&T Bell Laboratories
Murray Hill, New Jersey 07974




ABSTRACT

Computer program input generally has some structure; in fact, every computer program that does input can be thought of as defining an ``input language'' which it accepts. An input language may be as complex as a programming language, or as simple as a sequence of numbers. Unfortunately, usual input facilities are limited, difficult to use, and often are lax about checking their inputs for validity.

计算机程序输入一般有一定结构,事实上,每个接收输入的计算机程序可以认为它定义了一种它能够接受的“输入语言”。一个输入语言可能会复杂如一个程序设计语言,也可能简单到一串数字。不幸的是,通常的输入设备能力有限,难以使用,并且对输入的有效性检查很不严格。

 

Yacc provides a general tool for describing the input to a computer program. The Yacc user specifies the structures of his input, together with code to be invoked as each such structure is recognized. Yacc turns such a specification into a subroutine that handles the input process; frequently, it is convenient and appropriate to have most of the flow of control in the user's application handled by this subroutine.

Yacc 提供了一个通用工具来描述计算机程序的输入。Yacc 的用户指定它的输入的结构,与这种结构被识别后要执行的代码一起。Yacc 把这样的格式识别工作变成一个子程序,它处理输入过程;在用户应用中,用这个子程序来做相应控制经常是方便和适合的。

 

The input subroutine produced by Yacc calls a user-supplied routine to return the next basic input item. Thus, the user can specify his input in terms of individual input characters, or in terms of higher level constructs such as names and numbers. The user-supplied routine may also handle idiomatic features such as comment and continuation conventions, which typically defy easy grammatical specification.

Yacc 生成的输入子程序调用用户提供的程序来返回下一个基本输入单元。因此,用户可以在他的输入中指定以字符为单位,或者以更高的结构为单位,如名字和数。用户程序可能也会处理常见的典型的复杂语法特性,如注释和衔接

 

Yacc is written in portable C. The class of specifications accepted is a very general one: LALR(1) grammars with disambiguating rules.

Yacc 用可移植的C语言写成。可接收一个很通用的规则集合:有二义性消除的LALR(1)语法

 

In addition to compilers for C, APL, Pascal, RATFOR, etc., Yacc has also been used for less conventional languages, including a phototypesetter language, several desk calculator languages, a document retrieval system, and a Fortran debugging system.

除了作为C,APL,Pascal,RATFOR,等语言的编译器外,Yacc也已经被用在非常规语言,包括一个照片排版语言,一些桌面计算器语言,一个恢复系统,和一个Fortran调试系统。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值