词条 | ML/I |
释义 |
Typical uses of ML/1 include:
ML/1 was developed in 1966 by Peter J. Brown as part of PhD research at Cambridge University in England.[2] In 1984, Robert D. Eager, one of Peter Brown's colleagues at the University of Kent, rewrote ML/I, first in BCPL in 1981, and later in C in 1984, which increased its portability.
Since then, ML/1 has been ported to many platforms and operating systems, including VMS, MVS, MS-DOS, OS/2, and UNIX. In his implementations of ML/1, Bob Eager has added features and capabilities in addition to those originally specified in Peter Brown's thesis. That version is available for multiple platforms via the ML/1 web site, http://www.ml1.org.uk . The ML/1 web site provides further information about ML/1, as well as documentation (including a tutorial, simple introductory guide, and full user manual). Although the total number of ML/1 users in the world is small, there are ML/1 users all over the world, and Bob has corresponded with ML/1 users in the United States, Canada, Australia, New Zealand, Germany, Holland, and India. In a 1976 paper, Andrew S. Tanenbaum describes using ML/I as a compiler-compiler.[3] OverviewML/I accepts input in completely free form, treating data as a stream of bytes rather than a series of lines or records. It does not require any particular flagging of macro calls, which makes it particularly useful for processing arbitrary text. Replacements of text can be simple (e.g. PIG is to be replaced by DOG) or complex (e.g. replace the item between the third and fourth commas after the last full stop, by the contents of some counter). ML/I was used to implement several items of portable software, including itself. It was originally written in a special descriptive language, then mapped into a suitable language for each target system. This mapping was done using ML/I itself. There were two different forms of this descriptive language; high level and low level. After this mapping ML/I was often used to implement SIL's (system implementation languages, such as C) for the new generation of 16-bit architecture minicomputers. How ML/1 worksIn the most basic terms, here's how ML/1 works.
Distinctive features of ML/1There are several ways in which ML/1 is more powerful than simple "scan and replace" utilities. ML/1 does not process text on a character-string by character-string basis; it processes text on a word by word (or, in ML/1's terminology, on an "atom by atom") basis. For many applications, it is extremely useful to be able to process a text as a sequence of atoms rather than a sequence of characters. Suppose, for example, that we wish to translate a program from a programming language that has a DO ... END syntax, into a language that has a BEGIN ... END syntax. We therefore wish to replace "DO" with "BEGIN". If we do the replacement with an ordinary scan-and-replace utility, all occurrences of the string "DO" will be changed to "BEGIN", including any "DO"s that are embedded in words such as "DOCUMENT" (which will become "BEGINCUMENT"). With ML/1, in contrast, this will not happen because the string "DO" will trigger text-replacement only when it occurs as a word (that is, when it is preceded and followed by delimiters such as spaces, tabs, newlines, or punctuation characters). ML/1, rather than operating on a line-by-line basis, recognizes patterns of text that can be quite complex, nested, with multiple delimiters, and spanning many lines. ML/1 can, for instance, process a pattern such as the common programming language IF ... THEN ... ELSE ... ENDIF structure that spans multiple lines, and contains embedded text that itself may include a nested IF ... THEN ... ELSE ... ENDIF structure. ML/1 can recognize embedded comments and literal quotations, and protect them from alteration. Ordinary scan-and-replace utilities change strings indiscriminately, whether they occur in the program text as a keyword or variable name, embedded in a comment, or in a quoted literal. In order to deal with such complicated patterns, ML/1 needs to be a programming language in its own right. Like other programming languages, ML/1 supports variables and assignment statements, GOTOs and labels, IF... THEN tests and loops. These features give ML/1 an unusual degree of power and flexibility. LimitationsML/1 is case-sensitive, so it does not support case-insensitive text processing. References1. ^{{cite book|author=A. J. Cole|title=Macro Processors|url=https://books.google.com/books?id=Sz44AAAAIAAJ&pg=PA85|date=26 November 1981|publisher=CUP Archive|isbn=978-0-521-28560-5|page=85}} 2. ^{{cite journal|last1=Brown|first1=P. J.|title=The ML/I macro processor|journal=Communications of the ACM|volume=10|issue=10|year=1967|pages=618–623|issn=00010782|doi=10.1145/363717.363746}} 3. ^{{cite journal|last1=Tanenbaum|first1=A.S.|title=A General-Purpose Macro Processor as a Poor Man's Compiler-Compiler|journal=IEEE Transactions on Software Engineering|volume=SE-2|issue=2|year=1976|pages=121–125|issn=0098-5589|doi=10.1109/TSE.1976.233539}} External links
1 : Macro programming languages |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。