F1 Compiler FAQ
language translation provided by Jovana Milutinovich from WebHostingGeeks.com
Is it free?
Yes. Additionally, there are no royalties for programs created using F1, nor any restrictions
on redistributing of run-time libraries.
What's in the name...
FormulaOne is a logical programming language based on the first order logic, allowing writing programs using
language with syntax/semantics similar to logic formulae.
What is declarative programming?
The basic property of a declarative programming language is that a program is a theory in some suitable logic.
This property immediately gives a precise meaning to programs written in the language.
For a programmer this means that programming is lifted to a higher level of abstraction.
At this higher level of abstraction the programmer can concentrate on stating what is to be computed,
not necessarily how it is to be computed
Who should use the F1 compiler?
FormulaOne can be learned by a beginner but will be most appreciated by experienced programmers.
If you are a problem solver, FormulaOne's truly unique implementation of constraints will be invaluable.
Constraints enable numeric and logical problems to be solved more rapidly, by orders of magnitude.
In addition, FormulaOne's syntax leads to programs that are clear, concise and well structured, which
makes the language particularily suitable for computer science educational purposes
How does FormulaOne compare to Prolog?
There are many flavors and implementations of Prolog, so it is not easy to answer the question.
Syntactically FormulaOne and Prologs are completely different. For a non-Prolog programmer it is
much easier to read
and follow F1 source code than to read and follow Prolog source code.
Comparing the performance is not easy, as there are no official nor widely used logic programming
benchmarks. The few (rather obsolete) benchmarks we are aware of consist of some simple list
manipulations, which obviously do not benchmark anything of any importance to logic programming. Since there are
only a limited number of list operations, most implementations should produce more-less the same
benchmark results. These benchmarks reflect the power of CPUs more than anything else.
There is another way to compare performance: solve the same problem with various
compilers (using the same CPU) and compare the execution time. This is not quite cut-and-dry either:
the problems should have at least some complexity to be meaningful.
A good candidate is a problem such as
Benjamin Franklin's Magic Squares 8x8
: The problem is easy
to formulate, the program is easy to write in any declarative language, the problem has
a known number of solutions, yet finding all solutions is not trivial. It can take weeks
to find all
solutions, so it is easy to measure performance differences. We use this problem
internally to benchmark various FormulaOne releases.
Having said this, one of the reasons we chose the name FormulaOne
was because we honestly felt we produce very fast code and
there was no Prolog implementation that could outperform us. We would like to back up the claim with some real world numbers, so
if you are aware of any Prolog benchmark programs, please let us know. See our support page
for information how to contact us.
Is it a true compiler or an interpreter?
Although the FormulaOne source code may resemble a script language, it is fully compiled.
The FormulaOne is a true compiler; it generates standard DLL (Dynamic Load Library) files, or standard EXE (Executable) files.
Is FormulaOne open source?
No. It is not likely to become open source ever.
Does FormulaOne run under Linux?
We were able to install and run FormulaOne under Linux using Wine 0.9.52. Although we were able to recompile and successfully
run all sample code programs, at this point we cannot recommend running the F1 compiler under Linux. Wine (0.9.52) does not correctly implement
various features, such as context menus, rebar controls, ListView controls and generally does not redraw the IDE screen correctly.
Running the F1 compiler using Wine started by a command line spews many Wine error messages in the command line shell terminal.
Having said this, there is a good probability many of the bugs will be fixed in the next Wine release.
I think I found a bug...
If the system did not install correctly, crashes or does not behave according to the documentation,
we encourage you to file a bug report. We welcome bug reports and all bug reports are taken seriously.
The preferred method to submit a bug report is to use the built-in bug report generator using the F1 IDE itself, but
you can also submit the bug report directly using firstname.lastname@example.org
When submitting the bug report directly, please provide as much additional information as possible: OS version, CPU type and all
IDE/compiler individual component versions as displayed in the F1 IDE "About" dialog.
Do I need to register?
No. Registration of the F1 compiler is not compulsory. The main purpose of registration is
to allow us to keep track of "serious" users. The functionality of unregistered software is identical to a
registered one. Note: In the future we plan to offer certain add-on modules (such as symbolic debugger etc.) to registered
users only. When the time comes, we will announce it on our web site. You register by first sending us an e-mail using email@example.com
with the subject "registration". We will send you back a registration number which you can enter in the
registration dialog in the F1 IDE.
Is FormulaOne a continuation of Trilogy?
Trilogy, a programming language, was originally designed at Complete Logic Systems of North Vancouver in 1987.
It caused quite a stir at the time: positive reviews by Jerry Pournelle in BYTE; and various articles
from BYTE, PC Week, AI Expert. Another commercial version of Trilogy was released by Vertical Software
a few years later.
FormulaOne uses syntax and data types which are very similar to Trilogy,
so in this respect FormulaOne can be viewed as a Trilogy continuation.
This is a great project, how can I help out?
- File bug reports.
- Submit sample code.
- Create and submit third party system libraries.
- Help us with internalization/localization for languages other than English.
- Spread the word. If you own a web page: link to us. If you have a blog: mention us. Write a Wikipedia page.
When I compile my program, I get strange compiler errors...
As with practically all compilers you may get strange errors when compiling a program. What happens is that at some
point the compiler detects an error. At this point the compiler can either abort the compilation, or make an educated guess about the nature of the
error and continue compiling the program. Aborting the compilation after each error could result in a rather frustrating experience,
so the compiler continues the compilation based on some assumptions. If the assumptions were incorrect, the subsequent compilation will likely generate
some unexpected fictitious errors. This is why you should pay attentions to the very first error the most. Quite often fixing the very first error
causes all other errors to go away.
How do I distribute an executable?
Any executable will consist of several modules. These must all be distributed in order for
the executable to run correctly on the target system. The distribution consists of all user written
modules, F1 Run Time Library (F1RTL.DLL) and GMP (GNU Multi Precision Arithmetic Library, libgmp-3.dll).
For performance purposes, the GMP comes built for various CPUs.
When distributing the executable, you should ideally include the libgmp-3.dll that best matches the
CPU of the target system. This can be done by an install script, which detects the CPU when
installing the application and chooses the appropriate libgmp-3.dll. If the performance is not an issue,
you can simply distribute your application with libgmp-3.dll built for Pentium CPU or the "generic" libgmp-3.dll.
It is generally quite safe to assume the target system is Pentium compatible. Ideally, you install your application
using an installer, such as InstallShield, Microsoft MSI or Nullsoft Scriptable Install System (NSIS)
Starting with FormulaOne Release 41D, the FormulaOne IDE distribution contains NSIS (Nullsoft Scriptable Install System)
as part of the toolchain.
After creating a standalone executable, the user can now create a setup file which will
allow to redistribute/install his/her own executable on other PCs. The F1 IDE created default setup file creates a single
redistributable file, which will allow a user to install/uninstall the executable, optionally
creating desktop and/or menu shortcuts. The setup program will also install the best fitting
GMP library on the target machine based on the detected CPU. For detailed step-by-step instructions with screenshots
please consult How to Create a Redistributable Application.
Can I use code written in another programming language?
FormulaOne program can call routines located in modules compiled by other compilers, providing they use either
"C" calling convention or Microsoft _stdcall convention. Due to the non-standard use of
the stack by the F1 compiler, currently it is generally not possible for modules compiled by other compilers to call routines
compiled by the F1 compiler. However, we think interoperability with modules written in other languages merits continuous attention, for more details see
our plans for future development
Note: Starting with F1 release 42 it is possible to call F1 procs/subrs from modules not compiled by the F1 compiler.
What is an embedded source file?
FormulaOne linker allows for the inclusion of the full source code of a module within the compiled module itself.
This can be useful when distributing or archiving compiled modules.
Is there a memory garbage collection?
All memory needed by a program is fully managed by the compiler. Memory allocation/deallocation is automatic and typically the programmer does not
need to be concerned with it. All allocated memory will be eventually
deallocated once it is not needed. The default memory management algorithm is
very efficient with low overhead and is described in more detail in the FormulaOne language manual. However, there may be situations when eventually
is not soon enough
and the program runs out of all available memory before the memory is deallocated. In this case you can compile the program with a more aggressive garbage collection, using
"Settings->Compiler->Enable Garbage Collection". This setting overrides the default "lazy" garbage collection and causes memory deallocation as soon as possible.
Note that this is not an issue with true predicates: true predicates free unused memory automatically as a byproduct of backtracking.
I will not use the F1 compiler unless this feature (UTF-8, loop construct, etc.) is implemented...
Technically not really a question, more like an ultimatum, but fair enough. Though this sounds a lot like "I will not use C++ until it implements backtracking"
or "I will use assembler only when it has automatic garbage collection"
or "I will not use Java until it supports native 512bit integers"
. The point is, none of the several hundred
programming languages contains all possible features. Having said this, we welcome new ideas. Some of our
new ideas we consider in upcomming releases can be found in our page for future development
Page last updated: May 22, 2015