Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
XPL
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Components== ===XCOM=== The XPL compiler, called '''XCOM''', is a one-pass compiler using a table-driven [[parser]] and simple [[code generation (compiler)|code generation]] techniques. Versions of XCOM exist for different [[Instruction set|machine architectures]], using different hand-written code generation modules for those targets. The original target was [[IBM System/360]], which is a proper subset of [[IBM System/370]], [[IBM System/390]] and [[IBM System z]]. XCOM compiles from XPL source code, but since XCOM itself is written in XPL it can compile itself – it is a ''self-compiling compiler'', not reliant on other compilers. Several famous languages have self-compiling compilers, including [[Burroughs B5000]] Algol, PL/I, [[C (programming language)|C]], [[LISP]], and [[Java (programming language)|Java]]. Creating such compilers is a chicken-and-egg conundrum. The language is first implemented by a temporary compiler written in some other language, or even by an interpreter (often an interpreter for an intermediate code, as [[BCPL]] can do with [[intcode]] or [[O-code]]). XCOM began as an Algol program running on Burroughs machines, translating XPL source code into System/360 machine code. The XPL team manually turned its Algol source code into XPL source code. That XPL version of XCOM was then compiled on Burroughs, creating a self-compiling XCOM for System/360 machines. The Algol version was then thrown away, and all further improvements happened in the XPL version only. This is called [[bootstrapping (compilers)|bootstrapping]] the compiler. The authors of XPL invented the [[tombstone diagram]] or T-diagram to document the bootstrapping process. [[Retargeting]] the compiler for a new machine architecture is a similar exercise, except only the code generation modules need to be changed. XCOM is a one-pass compiler (but with an emitted code fix-up process for forward branches, loops and other defined situations). It emits [[machine code]] for each statement as each grammar rule within a statement is recognized, rather than waiting until it has parsed the entire procedure or entire program. There are no parse trees or other required intermediate program forms, and no loop-wide or procedure-wide optimizations. XCOM does, however, perform [[peephole optimization]]. The code generation response to each grammar rule is attached to that rule. This immediate approach can result in inefficient code and inefficient use of machine registers. Such are offset by the efficiency of implementation, namely, the use of dynamic strings mentioned earlier: in processing text during compilation, substring operations are frequently performed. These are as fast as an assignment to an integer; the actual substring is not moved. In short, it is quick, easy to teach in a short course, fits into modest-sized memories, and is easy to change for different languages or different target machines. ===ANALYZER=== The XCOM compiler has a hand-written [[Lexical analysis|lexical scanner]] and a mechanically-generated parser. The syntax of the compiler's input language (in this case, XPL) is described by a simplified [[BNF grammar]]. XPL's grammar analyzer tool '''ANALYZER''' or '''XA''' turns this into a set of large data tables describing all legal combinations of the syntax rules and how to discern them. This table generation step is re-done only when the language is changed. When the compiler runs, those data tables are used by a small, language-independent parsing algorithm to parse and respond to the input language. This style of table-driven parser is generally easier to write than an entirely hand-written [[recursive descent]] parser. XCOM uses a [[bottom-up parsing]] method, in which the compiler can delay its decision about which syntax rule it has encountered until it has seen the rightmost end of that phrase. This handles a wider range of programming languages than [[Top-down parsing|top-down]] methods, in which the compiler must guess or commit to a specific syntax rule early, when it has only seen the left end of a phrase. ===Runtime=== XPL includes a minimal '''runtime support library''' for allocating and garbage-collecting XPL string values. The source code for this library must be included into almost every program written in XPL. ===SKELETON=== The last piece of the XPL compiler writing system is an example compiler named '''SKELETON'''. This is just XCOM with parse tables for an example toy grammar instead of XPL's full grammar. It is a starting point for building a compiler for some new language, if that language differs much from XPL. ===XMON=== XPL is run under the control of a monitor, '''XMON''', which is the only operating system-specific part of this system, and which acts as a "loader" for XCOM itself or any programs which were developed using XCOM, and also provides three auxiliary storage devices for XCOM's use, and which are directly accessed by block number. The originally published XMON was optimized for [[History of IBM magnetic disk drives#IBM 2311|IBM 2311]]s. An XMON parameter FILE= enabled the monitor to efficiently use other disks with larger block sizes.<ref>A Compiler Generator page 251</ref> The working disk block size was also a compile-time constant in XCOM.<ref>A Compiler Generator, page 372</ref> XMON used a very simple strategy for disk direct access. NOTE provided the address of a disk track. POINT set the location of the next disk track to be the address previously returned by NOTE. This strategy was adopted to allow easy porting of XMON to other OSes, and to avoid the much more complicated disk direct access options available at that time.<ref>A Compiler Generator Appendix A1,7</ref> Converting XMON from its primitive use of NOTE, POINT and READ/WRITE disk operations—with precisely 1 block per track—to [[EXCP]] (i.e., write/create new records) and [[Execute Direct Access Program|XDAP]] (i.e., read/update old records)—with n blocks per track, where n was computed at run-time from the target device's physical characteristics and could be significantly greater than 1—achieved significantly improved application performance and decreased operating system overhead. Although originally developed for [[OS/360]], XMON (either the original NOTE, POINT and READ/WRITE implementation; or the EXCP and XDAP enhancement) will run on subsequently released IBM OSes, including OS/370, XA, [[OS/390]] and [[z/OS]], generally without any changes.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)