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
Clean (programming language)
(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!
==Compiling== Compilation of Clean to [[machine code]] is performed as follows: # Source files (.icl) and definition files (.dcl) are translated into Core Clean, a basic variant of Clean, by the compiler frontend written in Clean. # Core clean is converted into Clean's platform-independent intermediate language (.abc), by the compiler backend written in Clean and [[C (programming language)|C]]. # Intermediate ABC code is converted to object code (.o) by the code generator written in [[C (programming language)|C]]. # Object code is linked with other files in the module and the runtime system and converted into a normal executable using the system [[Linker (computing)|linker]] (when available) or a dedicated linker written in Clean on [[Windows]]. Earlier versions of the Clean compiler were written completely in [[C (programming language)|C]], thus avoiding bootstrapping issues. === The ABC machine === The ABC code mentioned above is an [[intermediate representation]] for an [[abstract machine]]. Because machine code generation for ABC code is relatively straightforward, it is easy to support new architectures. The ABC machine is an [[Imperative programming|imperative]] abstract [[graph rewriting]] machine.<ref>{{cite thesis|type=PhD|last1=Koopman|first1=Pieter|title=Functional Programs as Executable Specifications|date=10 December 1990|publisher=Katholieke Universiteit Nijmegen|isbn=90-9003689-X|page=35}}</ref> It consists of a graph store to hold the Clean graph that is being rewritten and three stacks: * The A(rgument)-stack holds arguments that refer to nodes in the graph store. * The B(asic value)-stack holds basic values (integers, characters, reals, etc.). Although these values could be nodes in the graph store, a separate stack is used for efficiency. * The C(ontrol)-stack holds return addresses for flow control. The [[runtime system]], which is linked into every executable, builds a <code>Start</code> node in the graph store and pushes it on the A-stack. It then begins printing it, evaluating it as needed. === Running Clean in the browser === Although Clean is typically used to generate native executables, several projects have enabled applications in [[web browser]]s. The now abandoned [https://clean.cs.ru.nl/SAPL SAPL] project compiled Core Clean to [[JavaScript]] and did not use ABC code. Since 2019, an interpreter for ABC code, written in [[WebAssembly]], is used instead.<ref>{{cite web |title=Clean and iTasks / ABC Interpreter Β· GitLab |url=https://gitlab.com/clean-and-itasks/abc-interpreter |website=Clean and iTasks on GitLab |access-date=13 April 2023 |language=en}}</ref><ref>{{cite book |last1=Staps |first1=Camil |last2=van Groningen |first2=John |last3=Plasmeijer |first3=Rinus |title=Proceedings of the 31st Symposium on Implementation and Application of Functional Languages |chapter=Lazy interworking of compiled and interpreted code for sandboxing and distributed systems |date=15 July 2021 |pages=1β12 |doi=10.1145/3412932.3412941|isbn=9781450375627 |s2cid=202751977 }}</ref>
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)