| |||||
Voodoo Compiler is an implementation of the Voodoo programming language. The Voodoo programming language is a minimal - degree programming language, abstracting about the platform's instruction set and contacting conventions, but in any other case leaving the programmer totally free to do anything at all.
Voodoo Compiler is prepared in Ruby and generates code for i386- appropriate, AMD64, and MIPS CPUs. Assist for additional concentrate on CPUs is prepared for the long term.
Utilization
There are two principal strategies to use the Voodoo compiler: by managing the voodooc plan, or by employing the Ruby API.
The voodooc program compiles a Voodoo supply files. Its usage is described in the voodooc. 1 manpage, integrated in the distribution. The pursuing is an illustration of how voodooc can be applied to make an executable hello from a supply file hello.voo:
$ voodooc hello there.voo
$ cc hello there.o -o hi
$./ hello there
Hi, earth !
An implementation of hi.voo can be observed in the listing check of the distribution.
The 2nd way to use the Voodoo compiler is by using it from a Ruby method. This can be applied, for case in point, to create code for the focus on system without possessing to make a.voo file. The adhering to is an case in point which creates an object file called simple fact.o, made up of a definition of a perform simple fact which computes factorials:
need 'voodoo'
generator = Voodoo::CodeGenerator.get_generator :architecture => :i386,
 : structure => :elf
generator.export : reality
generator. increase _ functionality _label : fact
generator. add _ function [:n],
 [:ifle, [:n, one ],
 # then
 [[:return, 1 ]],
 # else
 [[: enable, :x, :sub, :n, one ],
 [: established, :x, : phone, : fact, :x],
 [:return, :mul, :n, :x]]]
File. open up ('fact.o', 'w') outfile publish outfile
The Voodoo compiler API that is a available to Ruby applications is described in the API documentation.
Product's homepage
What is actually New in This Release : [ go through total changelog ]
· Compatibility with Ruby 1. nine, in addition to Ruby one. eight make test now reviews the quantity of passed and failed tests.
· The quite a few -vars check has been break up into numerous -args, numerous -args-tail, and quite a few -locals.
Via: Voodoo Compiler 1.1.1
No comments:
Post a Comment