gokr / spry

A Smalltalk and Rebol inspired language implemented as an AST interpreter in Nim
Other
389 stars 23 forks source link

Single period char crashes ispry #15

Open elcritch opened 4 years ago

elcritch commented 4 years ago

Trying out Spry. Interesting language!

I got this error when adding a period (".") to see what it'd do copying some smalltalk syntax I've seen:

Welcome to interactive Spry!
An empty line will evaluate previous lines, so hit enter twice.
>>> 1 + 1
>>> 
2
>>> . 
>>> 
spryvm.nim(383)          raiseParseException
Error: unhandled exception: Malformed local eval word, missing at least 1 character [ParseException]

I doesn't seem like an expected error.

elcritch commented 4 years ago

Just found another one! :-)

>>> 1
>>> 
1
>>> :a
>>> 
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Here I'm trying to understand why the repl keeps printing out the last value. I found it trying to understand why this yields a 1 on the last range:

>>> 1 to: 5 do: [echo :x]
>>> 
1
2
3
4
5
1
gokr commented 4 years ago

The last "1" is the "print the result of the expression" which is the receiver in this case - 1. So that always get's printed.

gokr commented 4 years ago

I am busy today with lots of stuff but will be around later this evening, there is also a Discord server for chatting a bit :)

elcritch commented 4 years ago

Ok, thanks! I'm not sure what's expected or not. I'll look up the Discord channel, or send an email to figure out when you'll be around.

gokr commented 4 years ago

There are several error handling holes for sure, but has not been my focus :)

Den lör 25 apr. 2020 10:49Jaremy Creechley notifications@github.com skrev:

Ok, thanks! I'm not sure what's expected or not. I'll look up the Discord channel, or send an email to figure out when you'll be around.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gokr/spry/issues/15#issuecomment-619345182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVUHWXEJNQ2EDANQEMYB3ROKP2BANCNFSM4MQU4H6A .

elcritch commented 4 years ago

For sure! I understand that, maybe I can help some. Sent you an email.

dumblob commented 4 years ago

maybe I can help some.

That'd be awesome - @gokr had some big plans with Spry and despite my lack of time, I'm highly interested in Spry (see e.g. https://github.com/gokr/spry/issues/14 ).

gokr commented 4 years ago

So... yeah, there is a specific word type called "local word" which has the syntax ".xxx". This is a word type that I actually haven't documented in the manual (I now note), so a single period has no meaning in Spry so Spry expects at least one more character to form such a word. See further at: http://sprylang.se/manual.html#scoping