Encyclopedia > Forth virtual machine

  Article Content

Forth virtual machine

Often, Forth implementations have a simple virtual machine at heart, consisting of three primitives. Those are:

  • nest, also called docol
  • unnest, or semi_s (;s)
  • next

three registers are used to implement the virtual machine, another one exists for passing data between words, which use the vm. These are:

different models exist to implement the forth vm, the one given here implements indirect threaded code, or ITC

 next:   (ip)+ ->   w    ;  jmp (w)+
 nest:    ip   -> -(rp)  ;  w -> ip  ;  next
 unnest: (rp)+ ->   ip   ;  next

other models are:

  • DTC (Direct Threaded Code)
  • STC (Subroutine Threaded Code)
  • TTC (Token Threaded Code)

less often used are

  • return threading
  • string threading
  • call threading



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Battle Creek, Michigan

... in the city is $35,491, and the median income for a family is $43,564. Males have a median income of $36,838 versus $26,429 for females. The per capita income for the city ...

 
 
 
This page was created in 45.5 ms