📄 e3
字号:
.NHLanguage Design.PPThe fundamental principle upon which we based our language designis that the language should be easy to useby people (for example, secretaries) who know neither mathematics nor typesetting..PPThis principle impliesseveral things.First,``normal'' mathematical conventions about operator precedence,parentheses, and the like cannot be used,for to give special meaning to such characters meansthat the user has to understand what he or sheis typing.Thus the language should not assume, for instance,that parentheses are always balanced,for they are not inthe half-open interval $(a,b]$.Nor should it assume thatthat $sqrt{a+b}$ can be replaced by$(a+b) sup roman \(12$,or that $1/(1-x)$ is better written as $1 over 1-x$(orvice versa)..PPSecond, there should be relatively few rules,keywords,special symbols and operators, and the like.This keeps the language easy to learn and remember. Furthermore, there should be few exceptions tothe rules that do exist: if something works in one situation,it should work everywhere.If a variable can have a subscript,then a subscript can have a subscript, and so on without limit..PPThird, ``standard'' things should happen automatically.Someone who types ``x=y+z+1'' should get ``$x=y+z+1$''.Subscripts and superscripts should automaticallybe printed in an appropriately smaller size,with no special intervention.Fraction bars have to be made the right length and positioned at theright height.And so on.Indeed a mechanism for overriding default actions has to exist,but its application is the exception, not the rule..PPWe assumethat the typist has a reasonable picture(a two-dimensional representation)of the desired final form, as might be handwrittenby the author of a paper.We also assume thatthe input is typed on a computer terminal much like an ordinary typewriter.This implies an input alphabetof perhaps 100 characters,none of them special..PPA secondary, but still important, goal in our designwas that the system should be easy to implement,since neither of the authors had any desire to makea long-term project of it.Since our design was not firm,it was also necessary that the program be easy to changeat any time..PPTo make the program easy to build and to change,and to guarantee regularity(``it should work everywhere''),the language is defined by acontext-free grammar, described in Section 5.The compiler for the language was built using a compiler-compiler..PPA priori,the grammar/compiler-compiler approach seemed the right thing to do.Our subsequent experience leads us to believethat any other course would have been folly.The original language was designed in a few days. Construction of a working systemsufficient to try significant examplesrequired perhaps a person-month.Since then, we have spent a modest amount of additional timeover several yearstuning, adding facilities,and occasionally changing the language as usersmake criticisms and suggestions..PPWe also decided quite early thatwe would let.UC TROFFdo our work for us whenever possible..UC TROFFis quite a powerful program, witha macro facility, text and arithmetic variables, numerical computation and testing,and conditional branching.Thus we have been able to avoid writinga lot of mundane but tricky software.For example, we store no text strings,but simply pass them on to.UC TROFF .Thus we avoid having to write a storage management package.Furthermore, we have been able to isolate ourselvesfrom most details of the particular device and character setcurrently in use.For example, we let.UC TROFFcompute the widths of all strings of characters;we need know nothing about them..PPA third design goal is special to our environment.Since our program is only useful for typesetting mathematics,it is necessary that it interface cleanly with the underlying typesetting languagefor the benefit of userswho want to set intermingled mathematics and text(the usual case).The standard mode of operationis that when a document is typed,mathematical expressions are input as part of the text,but marked by user settable delimiters.The program reads this input and treats as commentsthose things which are not mathematics,simply passing them through untouched.At the same time it converts the mathematical inputinto the necessary.UC TROFFcommands.The resulting ioutput is passed directly to.UC TROFFwhere the comments and the mathematical parts both becometext and/or.UC TROFFcommands.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -