fastvm / paka Goto Github PK
View Code? Open in Web Editor NEWPaka language
License: MIT License
Paka language
License: MIT License
dext currently has little doccumentation for its implementation.
a nice first file to document would be the dynamic object implementation in source/lang/dynamic.d
The following program will produce the wrong result on latest main branch e58bbc7:
$ cat compare.paka
if lt 0 0 { putchar 'Y' } else { putchar 'N' }
if lt 0 1 { putchar 'Y' } else { putchar 'N' }
if lt 1 0 { putchar 'Y' } else { putchar 'N' }
putchar '\n'
if lte 0 0 { putchar 'Y' } else { putchar 'N' }
if lte 0 1 { putchar 'Y' } else { putchar 'N' }
if lte 1 0 { putchar 'Y' } else { putchar 'N' }
putchar '\n'
if gt 0 0 { putchar 'Y' } else { putchar 'N' }
if gt 0 1 { putchar 'Y' } else { putchar 'N' }
if gt 1 0 { putchar 'Y' } else { putchar 'N' }
putchar '\n'
if gte 0 0 { putchar 'Y' } else { putchar 'N' }
if gte 0 1 { putchar 'Y' } else { putchar 'N' }
if gte 1 0 { putchar 'Y' } else { putchar 'N' }
putchar '\n'
Incorrect result:
$ bin/minivm bin/stage3.bc compare.paka -o compare.paka.bc && bin/minivm compare.paka.bc
NYN
YYN
YNY
NNY
Here's a fix to swap the implementations of gt
and gte
:
$ cat fix_gt_and_gte.patch
diff --git a/src/main.paka b/src/main.paka
index ecbbdc3..567f702 100644
--- a/src/main.paka
+++ b/src/main.paka
@@ -634,7 +634,7 @@ def emit_branch_alike(xcond jfalse jtrue out) {
if eq first op.do_gt {
let lhs emit_to get xcond 2 out
let rhs emit_to get xcond 3 out
- set out 0 cat get out 0 [[link.data [opcode.do_blt lhs rhs]] put_goto jtrue put_goto jfalse ]
+ set out 0 cat get out 0 [[link.data [opcode.do_blt rhs lhs]] put_goto jfalse put_goto jtrue]
return 0
}
if eq first op.do_lte {
@@ -646,7 +646,7 @@ def emit_branch_alike(xcond jfalse jtrue out) {
if eq first op.do_gte {
let lhs emit_to get xcond 2 out
let rhs emit_to get xcond 3 out
- set out 0 cat get out 0 [[link.data [opcode.do_blt rhs lhs]] put_goto jfalse put_goto jtrue]
+ set out 0 cat get out 0 [[link.data [opcode.do_blt lhs rhs]] put_goto jtrue put_goto jfalse ]
return 0
}
}
Correct result after patch and make
:
$ bin/minivm bin/stage3.bc compare.paka -o compare.paka.bc && bin/minivm compare.paka.bc
NYN
YYN
NNY
YNY
Hi,
I heard about this language in a discord server. Nice name. In my native language, the word 'paka' means revenge. :) Anyways, I would like to know about the string data type in paka. Is there any unicode support ?
where is src of boot.bc,how to build
dext crashes on some invalid input.
some things to note are table indexing and methods in source/lang/walk.d
I was trying to compile paka on windows with mingw and it failed with a message unknown ident: i
(bellow is the full log). On windows git automatically replace LFs to CRLFs, and further investigating I found out that minivm read files in binary mode, but \r\n
will only be read as \n
in text mode.
mkdir -p bin
make -C minivm minivm
make[1]: Entering directory '/c/dev/repo/paka/minivm'
cc -Os vm/minivm.c -o minivm
make[1]: Leaving directory '/c/dev/repo/paka/minivm'
cp minivm/minivm bin/minivm
bin/minivm bins/boot.bc src/main.paka -o bin/stage1.bc
unknown ident: i
bin/minivm bin/stage1.bc src/main.paka -o bin/stage2.bc
cannot run vm: file to run could not be read
bin/minivm bin/stage2.bc src/main.paka -o bin/stage3.bc
cannot run vm: file to run could not be read
After changing the line ending of src/main.paka
it worked just fine
mkdir -p bin
make -C minivm minivm
make[1]: Entering directory '/c/dev/repo/paka/minivm'
cc -Os vm/minivm.c -o minivm
make[1]: Leaving directory '/c/dev/repo/paka/minivm'
cp minivm/minivm bin/minivm
bin/minivm bins/boot.bc src/main.paka -o bin/stage1.bc
bin/minivm bin/stage1.bc src/main.paka -o bin/stage2.bc
bin/minivm bin/stage2.bc src/main.paka -o bin/stage3.bc
currently dext has no tests, only good and bad within the lang/
directory.
both compilation to bytecode and bytecode evaluation could use testing.
this should optimally be done in parallel with the upcoming test.*
library.
yes
joke but curious about the name
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.