文章目錄
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.
- Put the downloaded red binary in a folder that’s in the PATH, or just in the working folder.
- In a code or text editor, write the following Hello World program:
1
2
3
4
5Red [
Title: "Simple hello world script"
]
print "Hello World!" - Save it under the name: hello.red
- From a terminal (works from DOS too), run it with:
1
$ red hello.red
- You should see the Hello World! output.
- Want to generate a compiled executable from that program?
1
2$ red -c hello.red
$ ./hello - 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
近期评论