This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vec3: inline cover<T>{ | |
x, y, z: T | |
init: func@(=x, =y, =z) | |
plus: func(v: This) -> This{ | |
new(x + v x, y + v y, z+ v z) | |
} | |
print: func{ | |
printf("Vec3("(%s, %s, %s)\n", x as String, y as String, z as String) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import memory/Allocator | |
printf: extern func(String,...)->Int | |
Vec3: class{ | |
x, y, z: Float | |
init: func(=x,=y,=z){} | |
println: func{ | |
printf("(%f,%f,%f)\n",x,y,z) | |
} | |
} | |
Vec3 setAllocator(Allocator manual) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alloca: extern func(SizeT)->Pointer | |
Vec2: class{ | |
x, y: Float | |
init: func(=x,=y){} | |
print: func{"(%f, %f)\n" format(x, y) println()} | |
} | |
object:=alloca(Vec2 instanceSize) as Vec2 | |
object class=Vec2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test.ooc:9:11 [ERROR] Expected include, import, statement or declaration | |
afunction=func(x:Float)->Float{x*x} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allocator: cover{ | |
mallocPtr: Func(SizeT)->Pointer | |
callocPtr: Func(Int,SizeT)->Pointer | |
reallocPtr: Func(Pointer,SizeT)->Pointer | |
freePtr: Func(Pointer) | |
new: static func()->This{ | |
allocator: This | |
allocator mallocPtr=null | |
allocator callocPtr=null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Parsing source/rock/middle/FunctionCall.ooc | |
rock/middle/FunctionCall.ooc:553:17 [ERROR] Expected statement or a closing bracket | |
result := typeResult instanceOf(FuncType) ? | |
Now I get: | |
In file included from c-source/source/rock/middle/Module-fwd.h:27, | |
from c-source/source/rock/frontend/BuildParams-fwd.h:24, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro{ | |
//In here, we could get involved with the parsing and output of the file we are in | |
//Executed at compile time by the compiler | |
//The code in here would be considered an extension of rock | |
//We could use rock classes and such, like VariableAccess or VariableDecl, whatever | |
//Imagine that I am just switching a function call of ZombyWoof with FrankZappa within here | |
//A very trivial usage, but shows a point | |
} | |
FrankZappa: func(string: String){ |
NewerOlder