perl11 / potion Goto Github PK
View Code? Open in Web Editor NEW_why the lucky stiff's little language (the official repo... until _why returns)
Home Page: http://groups.google.com/group/potion-lang
License: Other
_why the lucky stiff's little language (the official repo... until _why returns)
Home Page: http://groups.google.com/group/potion-lang
License: Other
with bytecode and jit
mostly on travis
I would like to be able to print colored output to the terminal using ANSI escape codes
"\033[31mHello Potion\033[0m" print
This currently outputs 033[31mHello Potion033[0m
, not the desired 'Hello Potion' in red.
make install
fails when running redcloth
:
AR libpotion.a
CC core/potion.o
LINK potion-s
DOC doc/start.html
/opt/local/lib/ruby1.9/1.9.1/psych.rb:203:in `parse': (<unknown>): did not find expected node content while parsing a block node at line 183 column 9 (Psych::SyntaxError)
from /opt/local/lib/ruby1.9/1.9.1/psych.rb:203:in `parse_stream'
from /opt/local/lib/ruby1.9/1.9.1/psych.rb:151:in `parse'
from /opt/local/lib/ruby1.9/1.9.1/psych.rb:127:in `load'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:6:in `<module:LATEX>'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:3:in `<top (required)>'
from /opt/local/lib/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/local/lib/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/RedCloth-4.2.3/lib/redcloth.rb:21:in `<top (required)>'
from /opt/local/lib/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/local/lib/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/RedCloth-4.2.3/bin/redcloth:4:in `<top (required)>'
from /opt/local/libexec/ruby1.9/redcloth:23:in `load'
from /opt/local/libexec/ruby1.9/redcloth:23:in `<main>'
make: *** [doc/start.html] Error 1
This is redcloth 4.2.3 with ruby 1.9.3-p429. Is this version not supported?
Running OSX 10.8.3 and GNU Make 3.81
running API tests
............
OK (12 tests)
running GC tests
...F
There was 1 failure:
1) gc_test_forward: copied data not identical to original
!!!FAILURES!!!
Runs: 4 Passes: 3 Fails: 1
running VM tests
..............................................................................
running compiler tests
..............................................................................
running JIT tests
..............................................................................
OK (234 tests)
Trying to compile latest potion with clang and ccache produces this message:
CC core/potion.opic
clang: error: argument unused during compilation: '-I core'
It's because ccache is not yet fully clang-compatible, and it produces this warning, and you've requested by specifying -Werror
in config.mak that all warnings be turned into errors.
In MacPorts we run into this kind of problem a lot, and recommend that you don't ship build systems that use -Werror
, because you never know what kinds of new warnings will appear in compilers in the future.
Imagine if you added the following code between lines 43 and 44 of [http://github.com/orangea/potion/blob/1660fdf88bf9ee4cc8340187b28814aafb116681/core/file.c](This file):
printf("%lx\n", ((struct PNFile *)self)->path);
PN x = potion_byte_str(P, "");
printf("%lx\n", ((struct PNFile *)self)->path);
potion_bytes_obj_string(P, x, self);
printf("%lx\n", ((struct PNFile *)self)->path);
The printfs should always print the same thing, but they don't. I added those lines and then ran
File('a_valid_filename_here', 'r')
Here is the output on my computer:
100073870
2e4a226e0025000c
2e4a226e0025000c
Sometimes potion_bytes_obj_string
will modify the data too. I think that this might have something to do with either a bug in file.c or the GC not handling the File class correctly.
The last argument gets lost
b = 5
1 to b (x): x string print.
# ** block argument for to is not a closure
The code above should output 12345
Potion does not handle negative numbers very well. Seriously, type -1 string
or -1.0 string
. _why was of the new wave school of childhood education... every child gets a trophy!
Make doesn't work for me out of the box.
Information about my computer:
Ubuntu 12.04, x64,
Just installed clang with apt-get
The full error screen I get when running make:
$ make
Makefile:8: config.inc: No such file or directory
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
config.mak:159: config.inc: No such file or directory
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
MAKE config.inc
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
MAKE core/version.h
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
MAKE core/config.h
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CC core/potion.opic
CC core/asm.opic
CC core/ast.opic
CC core/callcc.opic +frame-pointer
core/callcc.c:88:1: error: unknown attribute 'no_address_safety_analysis' ignored
[-Werror,-Wattributes]
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
^
core/potion.h:31:62: note: expanded from:
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis))
^
1 error generated.
make: *** [core/callcc.opic] Error 1
Downloading a tarball of potion and running configure
and make
each produce several occurrences of this error message:
fatal: Not a git repository (or any of the parent directories): .git
we want to know how many minor and major collections were done,
and how long they ran (in ms). overall and per run. maybe also print the stack size.
-DG is too verbose to check timings.
Hey, built & all tests pass, but first run gives:
~/src/potion〉./potion
>> 5 times "hi" print
zsh: segmentation fault ./potion
The correct code is 5 times: "hi" print
, but this code should probably give a syntax or runtime error.
On both OpenBSD amd64 and Snow Leopard I get the following.
[james@thinkpad potion]$ ./potion
>> add = (x, y): x + y.
=> function(x, y)
>> add(2, 4) string print
nil=> nil
>>
Is this expect behavior? I would think I would get 6 returned. All tests pass when I run make test yet calling a simple function doesn't?
Building potion with make -w
produces an erroneous config.h file leading to a variety of errors:
CC core/potion.opic
In file included from core/potion.c:13:
In file included from core/potion.h:22:
core/config.h:5:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
make[2]: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^~~~
core/config.h:5:8: error: expected ';' after top level declarator
make[2]: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^
;
core/config.h:5:10: error: unknown type name 'Entering'
make[2]: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^
core/config.h:5:28: error: expected ';' after top level declarator
make[2]: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^
;
core/config.h:5:163: error: missing terminating ' character [-Werror,-Winvalid-pp-token]
make[2]: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^
core/config.h:34:162: error: missing terminating ' character [-Werror,-Winvalid-pp-token]
make[2]: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_potion/potion/work/potion-1be1e0bcf1c288cf34861ef864555eeb6245f2ff'
^
The purpose of make
's -w
option is to print lines "Entering directory" and "Leaving directory" at appropriate times, which is sometimes nice to see when one is trying to understand a build system, but for some reason these are ending up in potion's config.h file, which is obviously invalid syntax in that context. Using make
without the -w
option seems to be fine.
Makefile:12: config.inc: No such file or directory
config.mak:229: config.inc: No such file or directory
MAKE config.inc
MAKE core/version.h
MAKE core/config.h
CC core/potion.opic -O0
In file included from core/potion.c:7:
In file included from /usr/include/stdio.h:27:
/usr/include/features.h:327:4: error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
^
1 error generated.
make: *** [core/potion.opic] Error ]
Is there a specific branch I should be using?
>> (a=2, b=1, c=3)
=> (b=1, a=2, c=3)
I've got to say, I really hope this isn't intentional. If it is, it's certainly an interesting design desicion. :P
If there's no libuv.dylib found, darwin creates a libuv.dylib pointing to a -rpath /usr/local/lib/libuv.11.dylib, which is not installed.
Temp. workaround: sudo cp lib/libuv.11.dylib /usr/local/lib/
# true:
((10 / 2) == 5, "\n") join print
# Returns false, should be true
((60000000000 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2e+0) == 30e+9, "\n") join print
Integer range is probably lacking, but how do I cast/force a long/double in potion? I tried using the scientific notation, but to no avail.
When building on Snow Leopard the following error is displayed:
/var/folders/fK/fKeMA9H5HBKAWeq3RAEBT++++TI/-Tmp-//ccOvNlMc.s:58:suffix or operands invalid for `mov'
In potion, eval has some problems that make it behave strangely sometimes, such as that loop: 'x = Object()' eval.
segfaults while 'loop: x = Object().' eval
doesn't.
I think this is due to the fact that potion_eval
calls potion_parse
which overwrites data in the P
variable. One way to overcome this problem would be to create a new Potion
object in potion_eval
, but that would require using potion_create
/potion_init
, which overwrites global variables like PN_string
that are vital to the operation of the original Potion
object. The only way I can think of overcoming this is to use fork
in potion_eval
.
I am currently running a 64-bit Lubuntu, and after
git clone git://github.com/fogus/potion
cd potion
make
I run into the following errors:
{user}:~/Libraries/potion$ make DEBUG=1
make: execvp: ./tools/config.sh: Permission denied
CC core/potion.c
In file included from core/potion.c:13:0:
core/potion.h: In function ‘potion_gc_update’:
core/potion.h:468:30: error: ‘POTION_PAGESIZE’ undeclared (first use in this function)
core/potion.h:468:30: note: each undeclared identifier is reported only once for each function it appears in
core/potion.c: At top level:
core/potion.c:21:46: error: expected ‘,’ or ‘;’ before ‘POTION_PLATFORM’
core/potion.c: In function ‘potion_cmd_version’:
core/potion.c:54:3: warning: too many arguments for format [-Wformat-extra-args]
core/potion.c: In function ‘potion_cmd_compile’:
core/potion.c:113:69: error: ‘POTION_JIT_TARGET’ undeclared (first use in this function)
make: *** [core/potion.o] Error 1
Currently, there is no easy way to group expressions in Potion. To calculate 2 * (3 + 4)
, you have to type something like 2 * :3 + 4.()
or 2 * (3 + 4)(0)
. There should probably be an easier way to do this, like surrounding the expression to evaluate first with a character (ex. /3 + 4/
or |3 + 4|
or {3 + 4}
). I think that they should be grouped with a :
at the start and a ;
at the end, like 2 * :3 + 4;
. This syntax would be similar to the closure syntax.
Building potion produces output like this:
CC core/potion.opic
I want to see the full command that was used to compile the file. This is the usual way that make
operates, but your Makefile goes to some lengths to suppress this, and provides no option to turn this suppression off.
Other projects offer the variable V
which can be set to 1
to produce the usual verbose output, while setting V
to 0
would produce the abbreviated output you're currently producing.
tools/mk-release.sh fails to clean and build a libuv.dll properly
-liphlpapi must be used instead of -lphlpapi2
$ i686-w64-mingw32-gcc -v -g -O2 -shared src/libuv_la*.o src/win/*.o -o libuv.dll -lws2_32 -lpsapi -lpthread -liphlpapi
bin\libuv.dll
should be added to the zip, not tar.gz
[zkc@myhost git]$ git clone https://github.com/fogus/potion.git
...
( git commit: cf0db9a )
[zkc@myhost git]$ cd potion/
[zkc@myhost potion]$ make
CC core/potion.c
core/potion.c: In function 'potion_cmd_compile':
core/potion.c:113:69: error: 'POTION_JIT_TARGET' undeclared (first use in this function)
core/potion.c:113:69: note: each undeclared identifier is reported only once for each function it appears in
make: *** [core/potion.o] Error 1
The Makefile's dependencies don't seem to be entirely correct because building in parallel with make -j8
causes the error fatal error: 'config.h' file not found
:
Makefile:8: config.inc: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
config.mak:159: config.inc: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
MAKE config.inc
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
CC core/callcc.opic +frame-pointer
mkdir ../lib
CC tools/greg
ln -s `pwd`/libpotion.dylib ../lib/
In file included from core/callcc.c:11:
core/potion.h:22:10: fatal error: 'config.h' file not found
#include "config.h"
^
1 error generated.
make: *** [core/callcc.opic] Error 1
make: *** Waiting for unfinished jobs....
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
MAKE core/version.h
I'm on OSX, and cloned down a fresh copy of Potion. Whenever I try to evaluate a function in the repl
like so:
>> add = (x, y):
x + y string print.
>> add (1, 2)
It will always return nil
. It's very strange, because if I monkeypatch (e.g. String length(): 10.
), or load the built-in readline
lib, it will work perfectly.
It seems native extensions will work, but not potion functions themselves.
By the way, I've running OSX Mountain Lion if that somehow makes any difference.
MAKE core/config.h
CC core/potion.c
CC core/asm.c
CC core/ast.c
CC core/callcc.c +frame-pointer
core/callcc.c: In function ‘potion_continuation_yield’:
core/callcc.c:87:1: error: bp cannot be used in asm here
make: *** [core/callcc.o] Error 1
Trying to build commit 40b5f03 by running make
.
In the tools directory, the scripts config.sh and mk-release.sh use the command uname -o
. -o
is not a legal option for uname
on OS X, which results in the error message:
uname: illegal option -- o
usage: uname [-amnprsv]
# true:
((10 / 2) == 5, "\n") join print
# Returns false, should be true
((60000000000 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2e+0) == 30e+9, "\n") join print
Integer range is probably lacking, but how do I cast/force a long/double in potion? I tried using the scientific notation, but to no avail.
Hey, I sent here the error message I get when I try to "make" the code.
I was suggested to clone the repository, and then run make.
I just did, and I get a similar error message. [See below]. I hope I'm not spamming this list as I might be missing something simple due to lack of knowledge.
Appendix: My shell:
$ git clone https://github.com/perl11/potion.git
Cloning into 'potion'...
remote: Counting objects: 8515, done.
remote: Compressing objects: 100% (4015/4015), done.
remote: Total 8515 (delta 4978), reused 7871 (delta 4394)
Receiving objects: 100% (8515/8515), 3.63 MiB | 797 KiB/s, done.
Resolving deltas: 100% (4978/4978), done.
$ cd potion/
$ make
Makefile:8: config.inc: No such file or directory
config.mak:159: config.inc: No such file or directory
MAKE config.inc
MAKE core/version.h
MAKE core/config.h
CC core/potion.opic
CC core/asm.opic
CC core/ast.opic
CC core/callcc.opic +frame-pointer
core/callcc.c:88:1: error: unknown attribute 'no_address_safety_analysis' ignored
[-Werror,-Wattributes]
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
^
core/potion.h:31:62: note: expanded from:
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis))
^
1 error generated.
make: *** [core/callcc.opic] Error 1
readline.dll created via i686-w64-mingw32-gcc cross is linked with some libs which are not on a typical target system.
potion.exe fails to load the repl, "lib\potion\readline.dll": The specified procedure could not be found.
libgcj-12.dll
advapi32.dll
KERNEL32.dll
msvcrt.dll
WS2_32.dll
libpotion.dll
but loading aio works fine, when potion and the dll's are in the path.
potion examples\nbody.pn 500000
leads on windows to **potion_mmap failed
other gc heavy samples also, like gcbench.pn
This leads on linux to a SEGV in mark_major, because pngc_page_new
returned 0 without throwing an error, corrupting P->mem
I have found a lot of issues and possible features that are probably too small to have their own page so I will put them here.
Bugs:
a = 5, b (a) :.
)int
when they should be treated as long
.Features:
potion_get_caller()
function to get a method's caller.# true:
((10 / 2) == 5, "\n") join print
# Returns false, should be true
((60000000000 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30000000000, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2) == 30e+9, "\n") join print
((60e+9 / 2e+0) == 30e+9, "\n") join print
Integer range is probably lacking, but how do I cast/force a long/double in potion? I tried using the scientific notation, but to no avail.
Things work fine when using a variable as the lower bound, but Potion seems to segfault when using one as the upper bound. Example:
>> n = 3, n to 5 (i): i string print.
345=> 3
>> n = 5, 3 to n (i): i string print.
[1] 79643 segmentation fault ./potion
Am I missing something?
It seems that potion assumes that Unicode code points are 4 hex max:
sromanov@killdozer ~/mydev/potion $ cat example/unicode.pn
"I'm snowman - \u 2603\n" print
"I'm bactrian - \u 1f42b\n" print
bactrian is printed wrong (not displayable here)
\u is sometimes defined to use exactly 4 chars, so I propose to use \U not as in python requiring exact 8 chars, but
in a relaxed way allowing 4 or 5 hex chars.
Theoretically one could also use 6 chars, but this range U+100000 - U+10FFFF (Plane 16 Private Use only)
is not used yet. So I got for 4-5 and take the 6th as char for the next symbol.
\U xxxx or \U xxxxx and if the 5th char is accidently a hex char but should not belong to the unicode char
it will be a incompatible change.
syntax.y:
escU = esc 'U' < hexl hexl hexl hexl hexl? >
The second possibility is to use \u with 4 or 5 chars.
perl gets this right (since 5.8.9, at least), since it has {} delimiters
sromanov@killdozer ~/mydev/potion $ cat example/unicode.pl
binmode STDOUT, ":encoding(UTF-8)";
print "I'm snowman - \x{2603}\n";
print "I'm bactrian - \x {1f42b}\n";
I have supplied environment variables CFLAGS, CPPFLAGS and LDFLAGS when running the configure script, but when subsequently running make
(without those variables set) they are ignored. The configure script should record their values somewhere so that the Makefile can use them at build time.
On amd64 we could only address 15 local or upval vars via -n(%rpb),
on i386 max. 30 local or upval vars.
This limitation is now lifted by adding ASM_MOV_EBP() which checks
for the %ebp offset at compile-time and uses the word size insn if needed,
instead of the byte size insn before, which overflowed at 128.
#define ASM_MOV_EBP(op, reg)
if (reg > 15) { ASM(op+0x40); ASMI(RBPN(reg)); }
else { ASM(op); ASM(RBP(reg)); }
But it still doesn't work.
This is a parallel make issue, fixed with gmake-4.0 or by using -j1 with make-3.81
>> Object()
=> <Object a50f0>
>> Object()
=> <Object a5a78>
>> Object
=> Object
>> Object()
=> <Object a8640>
>> Object()
=> <Object a8fc8>
However,
while (Object != Object()):.
runs forever.
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.