Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Callisto
  • Cat
  • Cognate
  • colorForth
  • Concata
  • CoSy
  • Deque
  • DSSP
  • dt
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Fiveth
  • Forth
  • Fourth
  • Freelang
  • Gershwin
  • hex
  • iNet
  • Joy
  • Joy of Postfix App
  • kcats
  • Kitten
  • lang5
  • Listack
  • LSE64
  • Lviv
  • Meow5
  • min
  • Mirth
  • mjoy
  • Mlatu
  • Ode
  • OForth
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Prowl
  • Quest32
  • Quackery
  • r3
  • Raven
  • Retro
  • RPL
  • SPL
  • Staapl
  • Stabel
  • Tal
  • Titan
  • Trith
  • Uiua
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Concatenative topics

  • Compilers
  • Interpreters
  • Type systems
  • Object systems
  • Quotations
  • Variables
  • Garbage collection
  • Example programs

Concatenative meta

  • People
  • Communities

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Meta

  • Search
  • Farkup wiki format
  • Etiquette
  • Sandbox

Factor/FAQ/Implementation

Is Factor compiled or interpreted?

Factor is compiled. There are two compilers:

  • a minimal, non-optimizing JIT compiler (written in C++)
  • an optimizing compiler written in Factor

Most code compiles with the optimizing compiler, except for code which constructs new code at runtime.

If, by this, you mean "Does Factor produce standalone executables," the answer is yes; see the later question about deployment.

Why isn't my code compiling with optimizations?

For code to compile with the optimizing compiler, it has to have a consistent stack effect that the compiler can discern, meaning it always takes a consistent number of things off the top of the stack and puts a consistent number back on. The Factor compiler can't infer the stack effect of calling quotations that it can't inline at compile-time. Another possibility is that you left out an inline. inline is needed after every combinator definition, as a hint to the compiler.

Why isn't Factor fully self-hosted?

Making Factor self-hosted would essentially mean rewriting the virtual machine in a new, low-level DSL within Factor, avoiding all high-level features. This would not offer any real advantages over using C or C++, as it would not be interactively debuggable or replaceable. C++ is a suitable language for implementing low-level components.

Why aren't the C++ components of Factor implemented in my favorite other programming language?

C++ has many advantages over other programming languages. For one, GCC is heavily optimizing and readily available on almost all platforms. C++ is also suitable because it is very low-level and close to the machine. We need a programming language which gives us full control over the heap, since the image is saved by copying the heap directly.

Why not Factor for the Java Virtual Machine or .NET?

Originally, Factor was written in Java, and there was a compiler to JVM bytecode. But, to improve speed and the foreign function interface, Factor was rewritten in C and Factor. JFactor was abandoned in favor of CFactor. (The C code was later converted to C++.) At this point, basically no Factor code would work in the old JFactor unmodified because JFactor lacks several key features, such as generic words and syntax extension. Factor is currently natively compiled, not bytecode compiled. Removing the dependency on the JVM makes portability and distribution easier.

Why doesn't Factor use LLVM?

Factor supports some platforms that LLVM did not, and having a compiler written entirely in Factor is a good test for the language and allows highly specialized optimizations to be implemented. LLVM is a fine choice for a compiler backend, however, and if you are writing your own language you should take a look at it.

This revision created on Sun, 27 Dec 2009 21:29:33 by jckarter

Latest Revisions Edit

All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.