Jump to content

User:DavidBParker/Flaming Thunder

From Wikipedia, the free encyclopedia
Flaming Thunder
Websitehttp://www.flamingthunder.com/
Platforms32- and 64-bit FreeBSD, Linux, Mac OS X (Intel) and Windows
Latest release29 April 2008
ImplementationSingle-asset 8-by-8 shotgun cross compiler

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].

The Language

[edit]

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.

The Compiler

[edit]

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.

Implementation Details

[edit]

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.

Weaknesses

[edit]

The same implementation features that are the source of Flaming Thunder's strengths are also the source of its major weaknesses. The implementation of Flaming Thunder as a compiler written in Intel x86 assembly language strongly ties it to that hardware. It is very improbable that it will ever be ported to hardware that uses another instruction set because a complete rewrite would be necessary, unlike compilers written in higher level languages.

Also, since the compiler can only refer to internal assets, the user can never make use of any external program or library. Thus, there is no way to structure a large problem into multiple programs working in concert. Every feature of an application must be supported in a single Flaming Thunder program, with no support from external libraries in other languages (most notably C and C++). There is not even support for include files, so all code for an entire application must be in a single text file. There is also no support for structuring by objects or namespaces. Such lack of support for programming in the large means that Flaming Thunder is good only for small problems such as those assigned to students first learning to program.

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

References

[edit]

See also

[edit]
[edit]