From 86f31acf6789be116dcc54ed85b069a37c0f7aa8 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 11 Aug 2022 01:25:47 +0000 Subject: Actual modules and core --- pkg/lang/modules/core/core.lang | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 pkg/lang/modules/core/core.lang (limited to 'pkg/lang/modules/core/core.lang') diff --git a/pkg/lang/modules/core/core.lang b/pkg/lang/modules/core/core.lang new file mode 100644 index 0000000..e6be2d5 --- /dev/null +++ b/pkg/lang/modules/core/core.lang @@ -0,0 +1,78 @@ +type Type { +} + +native(":core:setup_type", Type) +global Type + +type Null { + () { + native(":core:Null:$init") + } +} + +type Int { + () { + native(":core:Int:$init") + } +} + +type Float { + () { + native(":core:Float:$init") + } +} + +type String { + () { + native(":core:String:$init") + } +} + +type Bool { + () { + native(":core:Bool:$init") + } +} + +type Array { + () { + native(":core:Array:$init") + } + + fn push(this, element) { + native(":core:Array:push", this, element) + } + + fn pop(this) { + return native(":core:Array:pop", this) + } + + fn length(this) { + return native(":core:Array:length", this) + } +} + +type Function { + () { + native(":core:Function:$init") + } +} + +fn say(message) { + native(":core:say", message) +} + +fn ping() { + return "Pong!" +} + +global Null +global Int +global Float +global String +global Bool +global Array +global Function + +global say +global ping \ No newline at end of file -- cgit 1.4.1