StackLanguge / stack-language

The official impilmentation of the Stack programming language created by BookOwl
4 stars 1 forks source link

Better parsing #14

Open an-OK-squirrel opened 8 years ago

an-OK-squirrel commented 8 years ago

as of right now, http://codegolf.stackexchange.com/a/62799/46787 is too big. I found that many times, I had to put spaces where spaces should not have been needed.

towerofnix commented 8 years ago

How else are you going to separate tokens? Whitespaces only take up a single byte of storage. I don't think semicolons quite fit the style of stack, it's not like each token is a separate statement after all.. though it may be handy for separating separate "sections" of tokens (though that's what I use new lines for).

towerofnix commented 8 years ago

Remember - != is a function just the same as ifelse, print, and llen are.

Perhaps it'd be okay for tokens to be placed directly beside strings and code blocks?

an-OK-squirrel commented 8 years ago

Perhaps it'd be okay for tokens to be placed directly beside strings and code blocks?

this is what I meant.

towerofnix commented 8 years ago

@BookOwl ping :package:

BookOwl commented 8 years ago

Sorry, I've been busy. I don't like the idea of allowing strings and other tokens to site right next to each other - it looks really ugly. '"spam""ham"print print just looks awful to me. However, I do agree with not needing whitespace around code blocks. IMHO, {1 print a}a def a` doesn't look so bad. Just so everybody knows, Stack is NOT meant to be a code golf language - I want it to be easy to use and read. I need to think about this some more.

towerofnix commented 8 years ago

It looks ugly.. but it also helps a lot in code golf.

This also looks ugly:

if(x|1)console.log("sup");

And this does as well:

function*(){yield n?5:3}

But they're both valid JavaScript and they're both safe a few bytes (think code golf).

towerofnix commented 8 years ago

Also, in Ruby, you could do this:

puts"Hi"

Or this:

puts("Hi")

Or this

puts "Hi"

If you were code golfing you'd use the one at the top, but if you were writing normal code you'd use the second or third.

Just saying it might be useful for code golf and file compression :package:

BookOwl commented 8 years ago

OK, you guys win. We can add this.

towerofnix commented 8 years ago

WE WINNNNNNNN :smiley: :clap: :rabbit: :rabbit: :rabbit: :rabbit:

BookOwl commented 8 years ago

Don't be to happy, or I might kick you out! :stuck_out_tongue: (Github tongues just aren't the same as Scratch's :crying_cat_face: )

jeandrek commented 8 years ago

Github tongues just aren't the same as Scratch's

They're Unicode :smile:s

towerofnix commented 8 years ago

Parsing is semi-better in #24 where comments are parsed a bit better and ignored by the interpreter.