diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000..800fda4 --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":["pretty","run"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/dryrun.log b/.vscode/dryrun.log new file mode 100644 index 0000000..582bef5 --- /dev/null +++ b/.vscode/dryrun.log @@ -0,0 +1,5 @@ +make --dry-run --always-make --keep-going --print-directory +make: Entering directory '/home/nocturn9x/Desktop/peon' +nim --hints:off --warnings:off r src/test.nim +make: Leaving directory '/home/nocturn9x/Desktop/peon' + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65e1ec0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} \ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000..b7ba9ee --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,300 @@ +make all --print-data-base --no-builtin-variables --no-builtin-rules --question +# GNU Make 4.3 +# Built for x86_64-pc-linux-gnu +# Copyright (C) 1988-2020 Free Software Foundation, Inc. +# License GPLv3+: GNU GPL version 3 or later +# This is free software: you are free to change and redistribute it. +# There is NO WARRANTY, to the extent permitted by law. + +# Make data base, printed on Tue Jun 14 09:42:22 2022 + +# Variables + +# environment +GDK_BACKEND = x11 +# environment +LC_ALL = C +# environment +NO_AT_BRIDGE = 1 +# environment +GTK_RC_FILES = /etc/gtk/gtkrc:/home/nocturn9x/.gtkrc:/home/nocturn9x/.config/gtkrc +# environment +VSCODE_IPC_HOOK_EXTHOST = /run/user/1000/vscode-ipc-6258d837-690b-477f-8d57-0859c0b5f31c.sock +# environment +LC_NAME = it_IT.UTF-8 +# environment +LC_NUMERIC = it_IT.UTF-8 +# environment +VSCODE_CWD = /home/nocturn9x/Desktop +# environment +LC_ADDRESS = it_IT.UTF-8 +# default +MAKE_COMMAND := make +# automatic +@D = $(patsubst %/,%,$(dir $@)) +# environment +DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1 +# environment +VSCODE_HANDLES_UNCAUGHT_ERRORS = true +# default +.VARIABLES := +# environment +PWD = /home/nocturn9x/Desktop/peon +# automatic +%D = $(patsubst %/,%,$(dir $%)) +# environment +MAIL = /var/spool/mail/nocturn9x +# environment +OLDPWD = /home/nocturn9x +# automatic +^D = $(patsubst %/,%,$(dir $^)) +# environment +VSCODE_LOG_STACK = false +# automatic +%F = $(notdir $%) +# environment +VSCODE_CODE_CACHE_PATH = /home/nocturn9x/.config/Code/CachedData/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 +# environment +XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session1 +# environment +LANG = C +# environment +XAUTHORITY = /home/nocturn9x/.Xauthority +# default +.LOADED := +# default +.INCLUDE_DIRS = /usr/include /usr/local/include /usr/include +# makefile +MAKEFLAGS = pqrR +# makefile +CURDIR := /home/nocturn9x/Desktop/peon +# environment +VSCODE_PIPE_LOGGING = true +# environment +APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1 +# automatic +*D = $(patsubst %/,%,$(dir $*)) +# environment +PAM_KWALLET5_LOGIN = /run/user/1000/kwallet5.socket +# environment +MFLAGS = -pqrR +# default +.SHELLFLAGS := -c +# environment +XDG_CONFIG_DIRS = /home/nocturn9x/.config/kdedefaults:/etc/xdg +# automatic ++D = $(patsubst %/,%,$(dir $+)) +# environment +XCURSOR_THEME = macOSBigSur +# environment +XDG_SESSION_DESKTOP = KDE +# makefile (from 'Makefile', line 1) +MAKEFILE_LIST := Makefile +# automatic +@F = $(notdir $@) +# environment +VSCODE_VERBOSE_LOGGING = true +# environment +VSCODE_PID = 11972 +# environment +XDG_SESSION_TYPE = x11 +# automatic +?D = $(patsubst %/,%,$(dir $?)) +# environment +SESSION_MANAGER = local/lappy:@/tmp/.ICE-unix/3457,unix/lappy:/tmp/.ICE-unix/3457 +# automatic +*F = $(notdir $*) +# environment +QT_QPA_PLATFORMTHEME = gtk +# environment +CHROME_DESKTOP = code-url-handler.desktop +# environment +DBUS_SESSION_BUS_ADDRESS = unix:abstract=/tmp/dbus-Pq1hKAgSJq,guid=1348e9625cb7b6cc326324c262a6ee28 +# automatic +"), "
"), "
")) diff --git a/stdin.pbc b/stdin.pbc new file mode 100644 index 0000000..5edc835 Binary files /dev/null and b/stdin.pbc differ diff --git a/tests/calls.pbc b/tests/calls.pbc new file mode 100644 index 0000000..de9a6ca Binary files /dev/null and b/tests/calls.pbc differ diff --git a/tests/calls.pn b/tests/calls.pn new file mode 100644 index 0000000..0a285e3 --- /dev/null +++ b/tests/calls.pn @@ -0,0 +1,15 @@ +fn noReturn(n: int) { + var n = n; + var `17` = 17; + return; +} + + +fn fooBar(a, b: int): int { + var baz = 38; + return a; +} + + +noReturn(1); +fooBar(1, 3); \ No newline at end of file diff --git a/tests/chainedCalls.pbc b/tests/chainedCalls.pbc new file mode 100644 index 0000000..bce749d Binary files /dev/null and b/tests/chainedCalls.pbc differ diff --git a/tests/chainedCalls.pn b/tests/chainedCalls.pn new file mode 100644 index 0000000..305ca54 --- /dev/null +++ b/tests/chainedCalls.pn @@ -0,0 +1,26 @@ +fn first(a, b: int): int { + return a; +} + +fn second(a, b: int): int { + return b; +} + + +fn last(a, b, c: int): int { + return c; +} + + +fn middle(a, b, c: int): int { + return last(a, c, b); +} + + +fn first(a, b, c: int): int { + return middle(b, a, c); +} + + +first(1, 2, 3); +var x = first(second(1, 2), 3); diff --git a/tests/closures.pbc b/tests/closures.pbc new file mode 100644 index 0000000..d344ed9 Binary files /dev/null and b/tests/closures.pbc differ diff --git a/tests/dispatch.pbc b/tests/dispatch.pbc new file mode 100644 index 0000000..15468ac Binary files /dev/null and b/tests/dispatch.pbc differ diff --git a/tests/functionObj.pbc b/tests/functionObj.pbc new file mode 100644 index 0000000..cbf9415 Binary files /dev/null and b/tests/functionObj.pbc differ diff --git a/tests/functionObj.pn b/tests/functionObj.pn new file mode 100644 index 0000000..0b56322 --- /dev/null +++ b/tests/functionObj.pn @@ -0,0 +1,17 @@ +fn getFunction: fn (n: int): int { + fn inner(n: int): int { + return n; + } + return inner; +} + + +getFunction()(5); + + +operator `+`(a, b: int): int { + #pragma[magic: "AddInt64"] +} + + +`+`(1, 2); \ No newline at end of file diff --git a/tests/generics.pn b/tests/generics.pn new file mode 100644 index 0000000..acf9ebb --- /dev/null +++ b/tests/generics.pn @@ -0,0 +1,16 @@ +operator `+`(a, b: int): int { + #pragma[magic: "AddInt64", pure] +} + + +operator `+`(a, b: int32): int32 { + #pragma[magic: "AddInt64", pure] +} + + +fn sum[T](a, b: T): T { + return a + b; +} + +sum(1, 2); +sum(1'i32, 2'i32); \ No newline at end of file diff --git a/tests/nestedCalls.pbc b/tests/nestedCalls.pbc new file mode 100644 index 0000000..ea74bcc Binary files /dev/null and b/tests/nestedCalls.pbc differ diff --git a/tests/nestedCalls.pn b/tests/nestedCalls.pn new file mode 100644 index 0000000..e626fa2 --- /dev/null +++ b/tests/nestedCalls.pn @@ -0,0 +1,18 @@ +fn outer: int { + fn inner: int { + return 69420; + } + return inner(); +} + + +fn outerTwo(n: int): int { + fn inner(z: int): int { + return z; + } + return inner(n); +} + + +outerTwo(5); +outer(); \ No newline at end of file diff --git a/tests/operators.pbc b/tests/operators.pbc new file mode 100644 index 0000000..5769cf4 Binary files /dev/null and b/tests/operators.pbc differ diff --git a/tests/operators.pn b/tests/operators.pn new file mode 100644 index 0000000..3ee6e48 --- /dev/null +++ b/tests/operators.pn @@ -0,0 +1,6 @@ +operator `+`(a, b: int): int { + #pragma[magic: "AddInt64", pure] +} + + +2 + 2; # Works! :D \ No newline at end of file diff --git a/tests/returnFn.pbc b/tests/returnFn.pbc new file mode 100644 index 0000000..7b9b101 Binary files /dev/null and b/tests/returnFn.pbc differ diff --git a/tests/returnFn.pn b/tests/returnFn.pn new file mode 100644 index 0000000..e7e0b46 --- /dev/null +++ b/tests/returnFn.pn @@ -0,0 +1,9 @@ +fn outer: fn (n: int): int { + fn inner(n: int): int { + return n; + } + return inner; +} + + +outer()(1);