Voodoo Compiler

Software Screenshot:
Voodoo Compiler
Software Details:
Version: 1.1.1
Upload Date: 20 Feb 15
Developer: Robbert Haarman
Distribution Type: Freeware
Downloads: 6

Rating: nan/5 (Total Votes: 0)

Voodoo Compiler is an implementation of the Voodoo programming language. The Voodoo programming language is a low-level programming language, abstracting over the platform's instruction set and calling conventions, but otherwise leaving the programmer free to do anything at all.

Voodoo Compiler is written in Ruby and generates code for i386-compatible, AMD64, and MIPS CPUs. Support for additional target CPUs is planned for the future.

Usage

There are two main ways to use the Voodoo compiler: by running the voodooc program, or by using the Ruby API.

The voodooc program compiles a Voodoo source files. Its usage is described in the voodooc.1 manpage, included in the distribution. The following is an example of how voodooc can be used to create an executable hello from a source file hello.voo:

$ voodooc hello.voo
$ cc hello.o -o hello
$ ./hello
Hello, world!


An implementation of hello.voo can be found in the directory test of the distribution.

The second way to use the Voodoo compiler is by using it from a Ruby program. This can be used, for example, to generate code for the target platform without having to create a .voo file. The following is an example which creates an object file called fact.o, containing a definition of a function fact which computes factorials:

require 'voodoo'

generator = Voodoo::CodeGenerator.get_generator :architecture => :i386,
 :format => :elf

generator.export :fact
generator.add_function_label :fact
generator.add_function [:n],
 [:ifle, [:n, 1],
 # then
 [[:return, 1]],
 # else
 [[:let, :x, :sub, :n, 1],
 [:set, :x, :call, :fact, :x],
 [:return, :mul, :n, :x]]]


File.open('fact.o', 'w') { |outfile| generator.write outfile }

The Voodoo compiler API that is a available to Ruby programs is described in the API documentation.

What is new in this release:

  • Compatibility with Ruby 1.9, in addition to Ruby 1.8; make test now reports the number of passed and failed tests.
  • The many-vars test has been split into many-args, many-args-tail, and many-locals.

What is new in version 1.0.1:

  • This version adds a number of improvements to the parser, which now reports source code locations for all errors and can report multiple errors inside blocks, functions, and conditionals. Several tests for the parser have been added.
  • This release fixes a parse error on statements followed by comments and a problem which caused the parser to fail on empty input.

What is new in version 1.0.0:

  • ARM code generator: The compiler can now generate assembly and ELF object code for the ARM architecture.
  • Improved error reporting: more errors are detected, and errors are reported in easier to understand error messages.
  • Validator module: this new module can be used to validate generated Voodoo code. It is used by the parser to validate parsed code.
  • Feature interface: features of the implementation can be queried both programmatically and from the command line.

What is new in version 0.7.0:

  • Blocks: these provide scopes in which local variables may be defined with let. Such variables exist from the end of the let statement until the end of the block. Blocks can occur in any place where an action can occur. They are started with block and ended with end block.
  • Chained conditionals: it is now possible to write "else if", instead of requiring a nested if in the else clause.
  • Shift and rotate: shift actions (asr, bsr, shl, shr) and rotate actions (rol, ror) have been added.
  • Return without value: return may now be used without specifying an expression to evaluate. This causes an undefined value to be returned from the function.

What is new in version 0.6.3:

  • This release introduces at-expressions: By prefixing a label, local variable, or integer with an @, the value is treated as an address, and the word stored at that address is returned.
  • Additionally, some bugs were uncovered in the way strings were encoded in generated assembly code.
  • These bugs have been fixed, and version 0.6.3 now handles strings containing all 256 possible byte values correctly.

What is new in version 0.6.2:

  • This release fixes bugs in the implementations of set-word for i386 and AMD64 and adds tests for the cases that previously did not work correctly.

Similar Software

runawk
runawk

19 Feb 15

Darning
Darning

20 Feb 15

Mercury
Mercury

15 Apr 15

Comments to Voodoo Compiler

Comments not found
Add Comment
Turn on images!