Skip to content

Instantly share code, notes, and snippets.

Blah blah blah vive les mindmap.
Vector3f: class {
x, y, z : Float
}
vec := Vector3f new()
vec x = 3.14
vec y = 6.18
vec z = 42.0 // hey, Java/C/C++/C# guys: look! no dots =)
main: func {
f : Float = 3.14159
d : Int32 = (f& as Int32*)@
printf("f = %f, d = %x\n", f, d)
d2 : Int32 = 0x40490fd0
f2 : Float = (d2& as Float*)@
printf("d2 = %x, f2 = %f\n", d2, f2)
Nut: class {
cracker: Int
init: func(cracker: Int) {
this cracker = cracker
}
}
The bird is eating worms
The animal is eating stuff
// check for a blank character; that is, a space or a tab
/*
isBlank: func -> Bool {
this == ' ' || this == '\t'
}
*/
Color: enum { red, green, blue }
c: Color
match(c) {
case red =>
case green =>
case blue =>
}
import structs/Array
main: func {
size := 12
arr := Array<Int> new(size)
for(i in 0..size / 2) {
arr set(i, i + 1)
}
// HashMap
HashMap: class <K, V> { // K = Key type, V = Value type
init: func {
if(V == NoneType) {
// assume string keys!
V = K
K = String
}
}
mkdir -p source/rock/parser/
greg ../nagaqueen/grammar/nagaqueen.leg > source/rock/frontend/NagaQueen.c
rule 'IMPLEMENT_KW' defined but not used
ooc -sourcepath=source/ -driver=sequence -noclean -g -shout -v +-w +-DROCK_BUILD_DATE=\"2010-02-20\" +-DROCK_BUILD_TIME=\"22:47\" source/rock/frontend/NagaQueen.c rock/rock -o=bin/rock
No compiler given ... using GCC
Parsing rock/rock.ooc
Parsing lang/stdio.ooc
Parsing lang/types.ooc
Parsing lang/math.ooc
Parsing lang/memory.ooc