Zum Inhalt springen

„C−−“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
[ungesichtete Version][ungesichtete Version]
Inhalt gelöscht Inhalt hinzugefügt
need IPA w respelling using AWB
Jerryobject (Diskussion | Beiträge)
K Removed needless piping in 1 link. Corrected stub tag.
Zeile 8: Zeile 8:
}}
}}


'''C--''' (pronounced "cee minus minus") is a [[C (programming language)|C]]-like [[programming language]]. Its creators, [[functional programming]] researchers [[Simon Peyton Jones]] and [[Norman Ramsey (computer scientist)|Norman Ramsey]], designed it to be generated mainly by [[compiler]]s for very high-level languages rather than written by human programmers. Unlike many other [[intermediate language]]s, its representation is [[ASCII|plain text]], not [[bytecode]] or another [[Binary data|binary]] format.
'''C--''' (pronounced "cee minus minus") is a [[C (programming language)|C]]-like [[programming language]]. Its creators, [[functional programming]] researchers [[Simon Peyton Jones]] and [[Norman Ramsey (computer scientist)|Norman Ramsey]], designed it to be generated mainly by [[compiler]]s for very high-level languages rather than written by human programmers. Unlike many other [[intermediate language]]s, its representation is plain [[ASCII]] text, not [[bytecode]] or another [[Binary data|binary]] format.


== Design ==
== Design ==
Zeile 15: Zeile 15:
Work on C-- began in the late 1990s. Since writing a custom [[Code generation (compiler)|code generator]] is a challenge in itself, and the compiler [[Front-end and back-end#Computer science|back ends]] available to researchers at that time were complex and poorly documented, several projects had written compilers which generated [[C (programming language)|C]] code (for instance, the original [[Modula-3]] compiler). However, C is a poor choice for functional languages: it does not support [[tail recursion]], accurate [[garbage collection (computer science)|garbage collection]] or efficient [[exception handling]]. C-- is a simpler, tightly-defined alternative to C which does support all of these things. Its most innovative feature is a run-time interface which allows writing of portable garbage collectors, exception handling systems and other run-time features which work with any C-- compiler.
Work on C-- began in the late 1990s. Since writing a custom [[Code generation (compiler)|code generator]] is a challenge in itself, and the compiler [[Front-end and back-end#Computer science|back ends]] available to researchers at that time were complex and poorly documented, several projects had written compilers which generated [[C (programming language)|C]] code (for instance, the original [[Modula-3]] compiler). However, C is a poor choice for functional languages: it does not support [[tail recursion]], accurate [[garbage collection (computer science)|garbage collection]] or efficient [[exception handling]]. C-- is a simpler, tightly-defined alternative to C which does support all of these things. Its most innovative feature is a run-time interface which allows writing of portable garbage collectors, exception handling systems and other run-time features which work with any C-- compiler.


The language's syntax borrows heavily from C. It omits or changes standard C features such as [[variadic function]]s, [[Pointer (computing)|pointer]] [[syntax]], and aspects of C's [[type system]], because they hamper certain essential features of C-- and the ease with which [[code-generation]] tools can produce it.
The language's syntax borrows heavily from C. It omits or changes standard C features such as [[variadic function]]s, [[pointer (computing)|pointer]] [[syntax]], and aspects of C's [[type system]], because they hamper certain essential features of C-- and the ease with which [[code-generation]] tools can produce it.


The name of the language is an in-joke, indicating that C-- is a reduced form of C, in the same way that [[C++]] is basically an expanded form of C. (In C and C++, "--" and "++" are operators meaning "subtract 1 from" and "add 1 to".)
The name of the language is an in-joke, indicating that C-- is a reduced form of C, in the same way that [[C++]] is basically an expanded form of C. (In C and C++, "--" and "++" are operators meaning "subtract 1 from" and "add 1 to".)
Zeile 40: Zeile 40:




{{compu-lang-stub}}
{{prog-lang-stub}}


[[fr:C-- (langage intermédiaire)]]
[[fr:C-- (langage intermédiaire)]]

Version vom 26. September 2010, 09:40 Uhr

Vorlage:Infobox programming language

C-- (pronounced "cee minus minus") is a C-like programming language. Its creators, functional programming researchers Simon Peyton Jones and Norman Ramsey, designed it to be generated mainly by compilers for very high-level languages rather than written by human programmers. Unlike many other intermediate languages, its representation is plain ASCII text, not bytecode or another binary format.

Design

C-- is a "portable assembly language", designed to ease the task of implementing a compiler which produces high-quality machine code by having the compiler generate C-- code, delegating the harder work of low-level code generation and optimisation to a C-- compiler.

Work on C-- began in the late 1990s. Since writing a custom code generator is a challenge in itself, and the compiler back ends available to researchers at that time were complex and poorly documented, several projects had written compilers which generated C code (for instance, the original Modula-3 compiler). However, C is a poor choice for functional languages: it does not support tail recursion, accurate garbage collection or efficient exception handling. C-- is a simpler, tightly-defined alternative to C which does support all of these things. Its most innovative feature is a run-time interface which allows writing of portable garbage collectors, exception handling systems and other run-time features which work with any C-- compiler.

The language's syntax borrows heavily from C. It omits or changes standard C features such as variadic functions, pointer syntax, and aspects of C's type system, because they hamper certain essential features of C-- and the ease with which code-generation tools can produce it.

The name of the language is an in-joke, indicating that C-- is a reduced form of C, in the same way that C++ is basically an expanded form of C. (In C and C++, "--" and "++" are operators meaning "subtract 1 from" and "add 1 to".)

C-- is a target platform for the Glasgow Haskell Compiler, and an adaptation of C-- will eventually become the main code-generation path. Some of C--'s developers, including Simon Peyton Jones, João Dias, and Norman Ramsey, also work or have worked on the Glasgow Haskell Compiler. The GHC codebase and development are based at Microsoft Research in Cambridge, though it is not a Microsoft project.

Type system

The C-- type system is deliberately designed to reflect constraints imposed by hardware rather than conventions imposed by higher-level languages. In C-- a value stored in a register or memory may have only one type: bit vector. However, bit vector is a polymorphic type and may come in several widths, e.g., bits8, bits32, or bits64. In addition to the bit-vector type C-- also provides a Boolean type bool, which can be computed by expressions and used for control flow but cannot be stored in a register or in memory. As in an assembly language, any higher type discipline, such as distinctions between signed, unsigned, float, and pointer, is imposed by the C-- operators or other syntactic constructs in the language.

Sphinx C--

The name "C--" was also used for an earlier programming language developed in the 1990s by Peter Cellik for x86 computers. Sphinx C-- mixes C with x86 assembly language.

See also


Vorlage:Prog-lang-stub