« first day (17 days earlier)      last day (145 days later) » 

14:34
Hmm... How are we going to implement goto in JavaScript?
14:45
We might have to either scrap JS or scrap goto statements.
15:00
Why can't we do it?
As long as we interpret it ourselves, it should be a-ok
Ok. I have no idea how we'll do it, but I guess we'll figure it out when we get to it.
I've written an example FizzBuzz program to use for writing/testing the lexer/parser/interpreter: gist.github.com/AMiller42/7219aaca47cc01753084635c49d3b521
It's very golfable, but this is just a testing thing, so it's ok.
15:18
Noice
It's golfier than Java lol
I updated it to explain it a bit better; take a look.
The switch statements are great, but can we make switch and case keywords and use them there?
More verbosity -> more readable obviously :P
@user sure, why not. In fact, here's an idea: Why don't we have both golfy and readable syntax for everything, and you can use whichever one you want, even mixing them together? That sounds like it could make for some pretty cursed programs. :)
But we need the readable syntax to still be cursed, so it can't just be while, switch, case, etc. Any ideas?
e.g. Slight typos, misleading synonyms, etc.
15:38
Instead of a simple switch, we could add pattern matching with a cursed twist
So switch would be match <expr> with this: with the cases following below
Each case could be something like if it matches <pattern>, then do :
Because everyone knows the more like English it looks, the easier it is to understand :)
So, basically, replace the cases with regexes to match the switch?
That sounds like a horrible idea.
Let's do it.
That sounds like it should be a motto of your language: "That sounds like a horrible idea. Let's do it."
I bags implementing pattern matching - it's something I've wanted to do for one of my own languages, and I think it'll be quite fun
About the parser, how about making multiple functions that either return an AST along with the rest of the code to be parsed OR a falsey value if it couldn't be parsed?
Or some kind of message: "Excepted ";" at index 69.0" (misspelling and decimal just to screw with the user)
@user As opposed to?
15:48
idek
Parser combinators or something wack
Yeah, none of that wack stuff.
@user Also, what we could do is make it so that you could use e.g. 1 or "hello" as literals for the cases, or you could use e.g. (var*3) as expressions for the cases, or e.g. /he*ld!/ as regexes for the cases.
@user sure, I have no idea how to do that anyway :P
@AaronMiller Actually, I guess that would be pretty useful. Let's just stick with the pattern matching switches like you suggested, and you can implement those.
@AaronMiller Good idea
@user I'll let you implement that stuff however you want.
16:09
Nice, thanks
I'm thinking since the readable syntax will be keywords instead of brackets, it'll use a mixture of keywords and indents to indicate flow: gist.github.com/AMiller42/7219aaca47cc01753084635c49d3b521
In this case, the switch statement is indented, and the loop is terminated by either EOF or the Did keyword, which acts as the end bracket of the loop, meaning you could goto out of the loop and do stuff until you hit a Did. You could even goto out of the loop and hit the opening statement of the loop, essentially nesting it inside of itself!
Also, for the default cases in the switch, the any is just a variable equal to *, or whatever the equivalent is in our regex implementation.
The During...Did loop is essentially a shorthand for :label:...if(stuff){goto ;label;}, but it is much simpler than just doing the label thing since the loop has that whole "confirm that we actually wanted to break the loop" thing, which would be very verbose to implement with switch statements and gotos.
16:26
👌

« first day (17 days earlier)      last day (145 days later) »