Compiler Description Language
≈ 5 min read
Names in other languages
- DeutschCompiler Description Language
- EnglishCompiler Description Language
- NederlandsCompiler Description Language
- PortuguêsCompiler Description Language
- فارسیزبان توصیف کامپایلر
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
Compiler Description Language (CDL) is a programming language based on affix grammars. It is very similar to Backus–Naur form (BNF) notation. It was designed for the development of compilers. It is very limited in its capabilities and control flow, and intentionally so. The benefits of these limitations are twofold. On the one hand, they make possible the sophisticated data and control flow analysis used by the CDL2 optimizers resulting in extremely efficient code. The other benefit is that they foster a highly verbose naming convention.
This, in turn, leads to programs that are, to a great extent, self-documenting. The language looks a bit like Prolog (this is not surprising since both languages arose at about the same time out of work on affix grammars). However, as opposed to Prolog, control flow in CDL is deterministically based on success/failure, i.e., no other alternatives are tried when the current one succeeds. This idea is also used in parsing expression grammars. CDL3 is the third version of the CDL language, significantly different from the previous two versions.
Evidence and sources
Compiler Description Language (CDL) is a programming language based on affix grammars. It is very similar to Backus–Naur form (BNF) notation. It was designed for the development of compilers. It is very limited in its capabilities and control flow, and intentionally so. The benefits of these limitations are twofold. On the one hand, they make possible the sophisticated data and control flow analysis used by the CDL2 optimizers resulting in extremely efficient code. The other benefit is that they foster a highly verbose naming convention.
This, in turn, leads to programs that are, to a great extent, self-documenting. The language looks a bit like Prolog (this is not surprising since both languages arose at about the same time out of work on affix grammars). However, as opposed to Prolog, control flow in CDL is deterministically based on success/failure, i.e., no other alternatives are tried when the current one succeeds. This idea is also used in parsing expression grammars. CDL3 is the third version of the CDL language, significantly different from the previous two versions.
ACTION quicksort + >from + >to -p -q: less+from+to, split+from+to+p+q, quicksort+from+q, quicksort+p+to; +. ACTION split + >i + >j + p> + q> -m: make+p+i, make+q+j, add+i+j+m, halve+m, (again: move up+j+p+m, move down+i+q+m, (less+p+q, swap item+p+q, incr+p, decr+q, *again; less+p+m, swap item+p+m, incr+p; less+m+q, swap item+q+m, decr+q; +)). FUNCTION move up + >j + >p> + >m: less+j+p; smaller item+m+p; incr+p, *. FUNCTION move down + >i + >q> + >m: less+q+j; smaller item+q+m; decr+q, *. TEST less+>a+>b:=a" +>b:=a"="b.
FUNCTION add+>a+>b+sum>:=sum"="a"+"b. FUNCTION halve+>a>:=a"/=2". FUNCTION incr+>a>:=a"++". FUNCTION decr+>a>:=a"--". TEST smaller item+>i+>j:="items["i"] i+>j-t:=t"=items["i"];items["i"]=items["j"];items["j"]="t. The primitive operations are here defined in terms of Java (or C). This is not a complete program; we must define the Java array items elsewhere. CDL2, which appeared in 1976, kept the principles of CDL1 but made the language suitable for large projects.
It introduced modules, enforced data-change-only-on-success, and extended the capabilities of the language somewhat. The optimizers in the CDL2 compiler and especially in the CDL2 Laboratory (an IDE for CDL2) were world-class and not just for their time. One feature of the CDL2 Laboratory optimizer is almost unique: it can perform optimizations across compilation units, i.e., treating the entire program as a single compilation. CDL3 is a more recent language.
It gave up the open-ended feature of the previous CDL versions, and it provides primitives to basic arithmetic and storage access. The extremely puritan syntax of the earlier CDL versions (the number of keywords and symbols both run in single digits) has also been relaxed. Some basic concepts are now expressed in syntax rather than explicit semantics. In addition, data types have been introduced to the language.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1310174926 under CC BY-SA 4.0; modifications have been made.