Skip to content

wbhart/bacon

Repository files navigation

Basic Arithmetic Console (BACON)
===============================

"Because everything is better with Bacon!"

Bacon is an initial attempt at a flint parser.

Currently it uses flint fmpz's for bignums, and will shortly have a foreign function interface.

Bacon is an imperative, statically typed, object oriented language, with an interactive console, jit compilation (via LLVM) and local type inference.

Documentation will be forthcoming.

Currently Bacon is still missing the following important features, though the infrastructure already exists in the implementation for most of these:

* Foreign function interface
* Parameterised types
* Generic functions
* Ability to load files
* A module system
* User defined constructors/destructors/operators
* For loops
* Array reallocation
* Bounds checking
* Ability to generate libraries/binaries
* Combined bignum/word operators/relations
* Print function
* Logical operators
* Combined assignment/arithmetic operators
* Binary operations/relations on arrays/tuples
* Assigning to places returned from a function
* Readline support

William Hart.

20 May 2014

Example Bacon program:

fn faciter(s : ref ZZ, n : ref ZZ) : ZZ {
   r = 1;
   i = s;
   d = s + n;
   while (i < d) {
      r = r*i;
      i = i + 1;
   }
   return r;
}

fn fac(s : ref ZZ, n : ref ZZ) : ZZ {
   if (n < 10) return faciter(s, n);
   
   n2 = n/2;
   return fac(s, n2)*fac(s + n2, n - n2);
}

fn fac(n : ref ZZ) : ZZ {
   return fac(1, n);
}
   
fac(1000000);

About

Basic Arithmetic Console

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published