introduction

文章目錄

Red is a new programming language, strongly inspired by REBOL, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting, while providing modern support for concurrency and multi-core CPUs.

Main characteristics are:

  • Functional, imperative and symbolic
  • Prototype-based object support
  • Homoiconic (Red is its own meta-language)
  • Optionally typed, rich set of datatypes (50+)
  • Both statically and JIT-compiled to native code
  • Concurrency and parallelism strong support (actors, parallel collections)
  • Low-level system programming abilities through the built-in Red/System DSL
  • High-level scripting and REPL console support
  • Highly embeddable
  • Low memory footprint, garbage collected
  • Low disk footprint (< 1MB)

Making a Red “Hello World”

The Red toolchain comes as a single half-megabyte executable file that you can download from here for the big-3 platforms.

  1. Put the downloaded red binary in a folder that’s in the PATH, or just in the working folder.
  2. In a code or text editor, write the following Hello World program:

    1
    2
    3
    4
    5
    Red [
    Title: "Simple hello world script"
    ]

    print "Hello World!"
  3. Save it under the name: hello.red
  4. From a terminal (works from DOS too), run it with:

    1
    $ red hello.red
  5. You should see the Hello World! output.
  6. Want to generate a compiled executable from that program?

    1
    2
    $ red -c hello.red
    $ ./hello
  7. Want to cross-compile to another supported platform?

    1
    2
    3
    $ red -t Windows hello.red
    $ red -t Darwin hello.red
    $ red -t Linux-ARM hello.red