Giter VIP home page Giter VIP logo

paka's People

Contributors

alexislefebvre avatar fennecdjay avatar orangebacon avatar shawsumma avatar slightknack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paka's Issues

Add implementation documentation

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

paka `gt` and `gte` produce incorrect results

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

Query about string in paka

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 ?

boot.bc

where is src of boot.bc,how to build

Its crash prone

dext crashes on some invalid input.
some things to note are table indexing and methods in source/lang/walk.d

Bootstrapping failed on windows because of CRLF

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

No tests

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.