Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Forth (programming language)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
=== Self-compilation and cross compilation === A full-featured Forth system with all source code will compile itself, a technique commonly called meta-compilation or [[Self-hosting (compilers)|self-hosting]], by Forth programmers (although the term doesn't exactly match [[Meta-Compilation|meta-compilation]] as it is normally defined). The usual method is to redefine the handful of words that place compiled bits into memory. The compiler's words use specially named versions of fetch and store that can be redirected to a buffer area in memory. The buffer area simulates or accesses a memory area beginning at a different address than the code buffer. Such compilers define words to access both the target computer's memory, and the host (compiling) computer's memory.<ref name="Swdke">{{cite web |last=Rodriguez |first=Brad |date=July–August 1995 |url=https://www.bradrodriguez.com/papers/moving8.htm |title=MOVING FORTH, Part 8: CamelForth for the 6809 |access-date=2023-04-29}}</ref> After the fetch and store operations are redefined for the code space, the compiler, assembler, etc. are recompiled using the new definitions of fetch and store. This effectively reuses all the code of the compiler and interpreter. Then, the Forth system's code is compiled, but this version is stored in the buffer. The buffer in memory is written to disk, and ways are provided to load it temporarily into memory for testing. When the new version appears to work, it is written over the previous version. Numerous variations of such compilers exist for different environments. For [[embedded system]]s, the code may instead be written to another computer, a technique known as [[Cross-compilation|cross compilation]], over a serial port or even a single [[Transistor-transistor logic|TTL]] bit, while keeping the word names and other non-executing parts of the dictionary in the original compiling computer. The minimum definitions for such a Forth compiler are the words that fetch and store a byte, and the word that commands a Forth word to be executed. Often the most time-consuming part of writing a remote port is constructing the initial program to implement fetch, store and execute, but many modern microprocessors have integrated debugging features (such as the [[Motorola CPU32]]) that eliminate this task.<ref name="E5iFy">{{cite web | last = Shoebridge | first = Peter | date = 1998-12-21 | url = http://www.zeecube.com/archive/bdm/index.htm | title = Motorola Background Debugging Mode Driver for Windows NT | access-date = 2006-06-19 | url-status = dead | archive-url = https://web.archive.org/web/20070606083244/http://www.zeecube.com/archive/bdm/index.htm | archive-date = 2007-06-06}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Forth (programming language)
(section)
Add topic