Thursday, December 03, 2009

Building an hello world program using gambit

We know that gambit-c allows you to compile scheme code into native executables by generating C files and then running them through a C compiler such as gcc. There are real advantages of doing so. You can even compile scheme to run an app on the iPhone.

On Windows, follow these steps to write your first hello world program that gambit then compiles to an executable.

  1. Download and install Gambit.
  2. Download and install MinGW
  3. Set your path to allow gsc to view gcc
  4. Write your hello world program
  5. run gsc -exe on the code and that's it.

You now have an exe that prints hello world.

Here's a small scheme example that prints hello world.




(define (hw)
(begin
(display "Hello World")
(newline)))

(hw)

No comments: