It's not
rocket science. Is it?
Started as a joke to learn the inner mechanics of a interpreted language, RocketLang quickly evolved into a long running project with more and more ambitious goals, such as being used forΒ Advent of Code to test it's limits.
π > puts("hello from rocket-lang!")
"hello from rocket-lang!"
=> nil
π > langs = ["ruby", "go", "crystal", "python", "php"]
=> ["ruby", "go", "crystal", "python", "php"]
π > langs.yeet()
=> "php"
π > langs.yoink("rocket-lang")
=> nil
π > langs
=> ["ruby", "go", "crystal", "python", "rocket-lang"]
Get started quickly
You can also install RocketLang via APT, RPM, as a binary or from source. See Β the install guideΒ for more detailed information.
- JSON
- HTTP
- Math
- Time
- Closures
π > JSON.parse('{"test": 123}')
=> {"test": 123.0}
π > a = {"test": 1234}
=> {"test": 1234}
π > a.to_json()
=> '{"test":1234}'
def test()
puts(request["body"])
return("test")
end
HTTP.handle("/", test)
HTTP.listen(3000)
π Β» Math.E
Β» 2.718281828459045
π Β» Math.Pi
Β» 3.141592653589793
π > Math.sqrt(3.0 * 3.0 + 4.0 * 4.0)
=> 5.0
π Β» Time.format(Time.unix(), "Mon Jan _2 15:04:05 2006")
Β» "Mon Oct 31 00:08:10 2022"
π Β» Time.format(Time.unix(), "%a %b %e %H:%M:%S %Y")
Β» "Mon Oct 31 00:28:43 2022"
π Β» Time.parse("2022-03-23", "2006-01-02")
Β» 1647993600
π Β» Time.parse("2022-03-23", "%Y-%m-%d")
Β» 1647993600
newGreeter = def (greeting)
return def (name)
puts(greeting + " " + name)
end
end
hello = newGreeter("Hello");
hello("dear, future Reader!");
=> "Hello dear, future Reader!"
Strong and stable builtins
RocketLang ships some neat builtins such as handling HTTP requests and responses, marshalling and unmashalling of JSON objects.
It also comes with support of closures, modules and context sensitive variables in order to create complex programs.
Everything is an object
Inspired by Ruby, in RocketLang everything is an object.
This allows to treat unknown input in the same way and figuring out what kind of information your function passes on the go. Every object supports the same minimum default subset of methods to achive this.
π > "test".type()
=> "STRING"
π > true.wat()
=> BOOLEAN supports the following methods:
plz_s()
π > 1.methods()
=> ["plz_s", "plz_i", "plz_f"]