Added some missing files

This commit is contained in:
Mattia Giambirtone 2022-06-14 22:45:41 +02:00
parent e32b8e258f
commit d3b9418fea
21 changed files with 427 additions and 0 deletions

1
.vscode/configurationCache.log vendored Normal file
View File

@ -0,0 +1 @@
{"buildTargets":["pretty","run"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}

5
.vscode/dryrun.log vendored Normal file
View File

@ -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'

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}

300
.vscode/targets.log vendored Normal file
View File

@ -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 <http://gnu.org/licenses/gpl.html>
# 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
<D = $(patsubst %/,%,$(dir $<))
# environment
VSCODE_NLS_CONFIG = {"locale":"en-us","availableLanguages":{},"_languagePackSupport":true}
# default
MAKE_HOST := x86_64-pc-linux-gnu
# makefile
SHELL = /bin/sh
# default
MAKECMDGOALS := all
# environment
SHLVL = 1
# environment
MAKELEVEL := 0
# default
MAKE = $(MAKE_COMMAND)
# environment
PATH = /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/opt/rocm-5.1.3/bin:/opt/rocm-5.1.3/hip/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/nocturn9x/.nimble/bin
# default
MAKEFILES :=
# environment
LC_MONETARY = it_IT.UTF-8
# environment
MOTD_SHOWN = pam
# automatic
^F = $(notdir $^)
# environment
LC_TIME = it_IT.UTF-8
# environment
VSCODE_LOG_NATIVE = false
# environment
LC_TELEPHONE = it_IT.UTF-8
# automatic
?F = $(notdir $?)
# environment
KDE_APPLICATIONS_AS_SCOPE = 1
# environment
XDG_SEAT = seat0
# environment
XDG_CURRENT_DESKTOP = KDE
# automatic
+F = $(notdir $+)
# environment
XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
# environment
DESKTOP_SESSION = plasma
# environment
ORIGINAL_XDG_CURRENT_DESKTOP = KDE
# 'override' directive
GNUMAKEFLAGS :=
# environment
QT_SCREEN_SCALE_FACTORS = eDP=1.125;HDMI-A-0=1.125;DisplayPort-0=1.125;
# environment
LOGNAME = nocturn9x
# environment
XDG_VTNR = 7
# makefile
.DEFAULT_GOAL := run
# environment
DISPLAY = :0
# environment
GTK_MODULES = canberra-gtk-module
# environment
USER = nocturn9x
# default
MAKE_VERSION := 4.3
# environment
KDE_SESSION_UID = 1000
# environment
LC_MEASUREMENT = it_IT.UTF-8
# environment
QT_STYLE_OVERRIDE = gtk2
# environment
_ = /usr/bin/make
# environment
LC_PAPER = it_IT.UTF-8
# environment
XDG_RUNTIME_DIR = /run/user/1000
# environment
XDG_SESSION_CLASS = user
# environment
VSCODE_AMD_ENTRYPOINT = vs/workbench/api/node/extensionHostProcess
# environment
GTK2_RC_FILES = /etc/gtk-2.0/gtkrc:/home/nocturn9x/.gtkrc-2.0:/home/nocturn9x/.config/gtkrc-2.0
# environment
HOME = /home/nocturn9x
# environment
ELECTRON_RUN_AS_NODE = 1
# environment
VSCODE_IPC_HOOK = /run/user/1000/vscode-538ebeb8-1.67.2-main.sock
# environment
XDG_SESSION_ID = 1
# environment
XCURSOR_SIZE = 24
# default
.RECIPEPREFIX :=
# automatic
<F = $(notdir $<)
# default
SUFFIXES :=
# environment
QT_AUTO_SCREEN_SCALE_FACTOR = 0
# environment
VSCODE_CLI = 1
# environment
ELECTRON_NO_ATTACH_CONSOLE = 1
# environment
KDE_SESSION_VERSION = 5
# default
.FEATURES := target-specific order-only second-expansion else-if shortest-stem undefine oneshell nocomment grouped-target extra-prereqs archives jobserver output-sync check-symlink guile load
# environment
KDE_FULL_SESSION = true
# environment
QTWEBENGINE_CHROMIUM_FLAGS = -blink-settings=darkModeEnabled=true -enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter
# environment
LC_IDENTIFICATION = it_IT.UTF-8
# variable set hash-table stats:
# Load=108/1024=11%, Rehash=0, Collisions=5/138=4%
# Pattern-specific Variable Values
# No pattern-specific variable values.
# Directories
# . (device 66306, inode 4066154): 14 files, no impossibilities.
# 14 files, no impossibilities in 1 directories.
# Implicit Rules
# No implicit rules.
# Files
pretty:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# recipe to execute (from 'Makefile', line 5):
nimpretty src/*.nim src/backend/*.nim src/frontend/*.nim src/frontend/meta/*.nim src/memory/*.nim src/util/*.nim
# Not a target:
Makefile:
# Implicit rule search has been done.
# Last modified 2022-05-23 23:23:11.372694164
# File has been updated.
# Successfully updated.
# Not a target:
.DEFAULT:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# Not a target:
all:
# Command line target.
# Implicit rule search has been done.
# File does not exist.
# File has not been updated.
run:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# recipe to execute (from 'Makefile', line 2):
nim --hints:off --warnings:off r src/test.nim
# files hash-table stats:
# Load=6/1024=1%, Rehash=0, Collisions=0/16=0%
# VPATH Search Paths
# No 'vpath' search paths.
# No general ('VPATH' variable) search path.
# strcache buffers: 1 (0) / strings = 21 / storage = 156 B / avg = 7 B
# current buf: size = 8162 B / used = 156 B / count = 21 / avg = 7 B
# strcache performance: lookups = 27 / hit rate = 22%
# hash-table stats:
# Load=21/8192=0%, Rehash=0, Collisions=0/27=0%
# Finished Make data base on Tue Jun 14 09:42:22 2022
make: *** No rule to make target 'all'. Stop.

11
src/peon.nim Normal file
View File

@ -0,0 +1,11 @@
import backend/vm
import frontend/lexer
import frontend/parser
import frontend/compiler
proc runPeon*(s: string) =
## Executes a string containing
## peon code
newPeonVM().run(newCompiler().compile(newParser().parse(newLexer().lex(s, "<main>"), "<main>"), "<main>"))

BIN
stdin.pbc Normal file

Binary file not shown.

BIN
tests/calls.pbc Normal file

Binary file not shown.

15
tests/calls.pn Normal file
View File

@ -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);

BIN
tests/chainedCalls.pbc Normal file

Binary file not shown.

26
tests/chainedCalls.pn Normal file
View File

@ -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);

BIN
tests/closures.pbc Normal file

Binary file not shown.

BIN
tests/dispatch.pbc Normal file

Binary file not shown.

BIN
tests/functionObj.pbc Normal file

Binary file not shown.

17
tests/functionObj.pn Normal file
View File

@ -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);

16
tests/generics.pn Normal file
View File

@ -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);

BIN
tests/nestedCalls.pbc Normal file

Binary file not shown.

18
tests/nestedCalls.pn Normal file
View File

@ -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();

BIN
tests/operators.pbc Normal file

Binary file not shown.

6
tests/operators.pn Normal file
View File

@ -0,0 +1,6 @@
operator `+`(a, b: int): int {
#pragma[magic: "AddInt64", pure]
}
2 + 2; # Works! :D

BIN
tests/returnFn.pbc Normal file

Binary file not shown.

9
tests/returnFn.pn Normal file
View File

@ -0,0 +1,9 @@
fn outer: fn (n: int): int {
fn inner(n: int): int {
return n;
}
return inner;
}
outer()(1);