User:DavidBParker/Flaming Thunder

From Wikipedia, the free encyclopedia

Flaming Thunder
Website http://www.flamingthunder.com/
Platforms 32- and 64-bit FreeBSD, Linux, Mac OS X (Intel) and Windows
Latest release 29 April 2008
Implementation Single-asset 8-by-8 shotgun cross compiler
This box: view  talk  edit

Flaming Thunder is a compiled computer programming language that supports numeric computation, arbitrary precision numbers, interval arithmetic, symbolic computation, CGI scripting and cross compilation. Flaming Thunder does not have built-in graphics yet, but all subscriptions come with a free subscription to the DPGraph[1] dynamic 3D graphing package.

Over 1,000 universities, colleges and schools have subscriptions to Flaming Thunder[2].

Contents

[edit] The Language

Flaming Thunder's design philosophy is to make computer programming as easy as possible by leveraging existing fluencies in English and math. In Flaming Thunder, the program to write "hello world" is:

   Write "hello world".

Flaming Thunder statements can be written in paragraph form:

   Write "Please enter a color: ".  Read color.  Write "My favorite color is ", color.

Like English, Flaming Thunder is not case sensitive. The following program rereads color if an error occured:

   Read color.  If color is an error then read color.

In math the negative of a negative is a positive, so Flaming Thunder does not redefine "--" to mean predecrement. The following Flaming Thunder program will write "true".

   If x = --x then write "true".

Flaming Thunder uses Set statements for assignment:

   Set x to "concrete".

Set statements make it possible to manipulate symbolic equations without the confusion of multiple equal signs:

   Set QuadraticEquation to a*x^2 + b*x + c = 0.

Flaming Thunder does not abbreviate or cojoin common English words. For example, go and to are separate words:

   Read commmand.  If command = "quit" then go to end.

Control statements are designed so that a person who is not fluent in math does not have to use math symbols:

   Write "Fa".  For i from 1 to 8 do write "-la".

Flaming Thunder isolates users from the numeric limitations (32-bit, 64-bit, single, double, etc) of their hardware, so numeric computations are arbitrary precision. The Flaming Thunder program to compute a real number, the golden ratio φ = (1 + √5)/2, to a precision of 1,000 decimal digits is:

   Set realdecimaldigits to 1000.
   Write (1+squareroot(5))/2.

For readability, Flaming Thunder ignores underscores in words and numbers:

   Set TwentyTrillion to 20_000_000_000_000.

[edit] The Compiler

The compiler for Flaming Thunder is a single-asset 8-by-8 shotgun cross compiler.

Cross compilers have inherent O(mnp) weakest-link and version-coherence ("DLL hell") problems, where m is the number of assets (files) in the tool chain (executables, libraries, etc), n is the number of hosts and p is the number of targets. For many cross compilers m, n and p are roughly comparable, so that the maintenance and debugging problems are roughly O(n3).

To avoid those O(n3) difficulties, many cross-platform languages are implemented as interpreters. That reduces the maintenance and debugging problems to O(n) because it's only necessary to have one interpreter per platform. This makes life easier for the language implementers, but results in slower, bigger-footprint programs because users also have to install the interpreter.

Another way to reduce the problem to O(n) is to write a single-asset n-by-p shotgun cross compiler. That makes life a little more difficult for the language implementers, but it leads to faster, more compact results for users.

Since the main goal of Flaming Thunder is to make life easier for users, and not for the language implementers, Flaming Thunder is written as a single-asset 8-by-8 shotgun cross compiler.

Flaming Thunder supports 8 major architectures: FreeBSD 32, FreeBSD 64, Linux 32, Linux 64, Mac OS X Intel 32, Mac OS X Intel 64, Windows 32 and Windows 64. There are a plethora of minor versions within those major architectures (for example, Windows 64 includes both Windows Vista Ultimate 64 and Windows XP Professional x64, among others), but they are not counted as separate targets because the executables generated by Flaming Thunder auto-detect minor differences. Flaming Thunder, running on any of those 8 architectures, can produce executables for any of those 8 architectures, so Flaming Thunder is an 8-by-8 cross compiler.

Flaming Thunder is a single-asset cross compiler because all of the tools and libraries that Flaming Thunder needs are internal to the executable file for the Flaming Thunder compiler. Flaming Thunder compiles directly from source code to stand-alone statically-linked executables without using any external tools or libraries.

When running on a particular host, many cross compilers not only require external tools or libraries, but they require different versions of those tools or libraries for each target. Flaming Thunder, however, is a shotgun cross compiler: it can hit all of its targets using only the single executable file for the Flaming Thunder compiler. For example, the following command line (ft is the name of the compiler):

    ft file myprogram.ft target all

will produce 8 target executable files: myprogram-f32, myprogram-f64, myprogram-l32, myprogram-l64, myprogram-m32, myprogram-m64, myprogram-w32.exe and myprogram-w64.exe.

A cross compiler such as Flaming Thunder leads to immediate benefits for programmers and internet users alike. Programmers can write CGI scripts under their favorite architecture (most people have Windows or Mac desktops or notebooks), then cross compile their CGI scripts for Linux, then ftp them up to an inexpensive Linux webhosting account. For example, the command to compile mycgi.ft on a Mac into a Linux executable that can be immediately ftp'ed up to a website is:

    ft file mycgi.ft output mycgi.cgi target linux32

The benefit for internet users is that websites with statically-linked compiled CGI scripts are more agile than those with interpreted web pages.

[edit] Implementation Details

The compiler and all internal libraries for Flaming Thunder are written entirely in mixed 32- and 64-bit assembly language.

Another reason for Flaming Thunder's small disk footprint (currently less than 170K) is that many routines are common between different operating systems. For example, the 32-bit routine for converting arbitrary-precision integers to strings is the same for all 32-bit target operating systems, so only one copy needs to be included in the Flaming Thunder executable.

[edit] Strengths and Weaknesses

Some of Flaming Thunder's weaknesses right now are: only rudimentary support for symbolic operations, no support for advanced data types such as structures, and no inline assembly language.

Another weakness in Flaming Thunder is no built-in graphics.

[edit] References

[edit] See also

[edit] External links