Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » PigeonScript - a Golfing Language
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Ohhhhh you accidently gave me the answer to the problem! (I hope)Wouldn't that fail because the functions are defined after you reference them in the object?Can I see the current code for parse()? The one on Github has syntax errors.This one shouldn't have the syntax errors.
Sigton
It doesn't fail, but because I'm referencing before assignement then the object is just being filled with undefined because it is undefined. Thanks xD
Sigton
EDIT: Yes that was the problem, thanks for your help

Last edited by Sigton (Nov. 28, 2016 17:57:51)
- -Io-
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Ohhhh, the problem is in how you're defining your functions.Can I see the current code for parse()? The one on Github has syntax errors.This one shouldn't have the syntax errors.
Sigton
Normal function statements get hoisted: (you can always access them no matter where you define them)
hoisted(); // logs "foo" function hoisted() { console.log("foo"); }
notHoisted(); // TypeError: notHoisted is not a function var notHoisted = function() { console.log("bar"); };
You have to either change sum, sub, mult and div to use a function statement, or declare them before you declare “functions”.
EDIT: dangit ninja'd

Last edited by -Io- (Nov. 28, 2016 17:59:58)
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Sorry, first time I've really used JS 
Sigton

Sigton
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Great, the js interpreter now works perfectly ;D
Sigton
Sigton
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Great, the js interpreter now works perfectly ;DString support has been added, I'll work on arrays tomorrow.
Sigton
Sigton
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
With all of the implicit opening/closing (?) quote stuff done - and backslash escaping?Great, the js interpreter now works perfectly ;DString support has been added, I'll work on arrays tomorrow.
Sigton
Sigton
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Implicit opening will take a minute, and I haven't got around to backslash escaping in either languageWith all of the implicit opening/closing (?) quote stuff done - and backslash escaping?Great, the js interpreter now works perfectly ;DString support has been added, I'll work on arrays tomorrow.
Sigton
Sigton

Sigton
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Implicit opening will take a minute, and I haven't got around to backslash escaping in either languageWith all of the implicit opening/closing (?) quote stuff done - and backslash escaping?Great, the js interpreter now works perfectly ;DString support has been added, I'll work on arrays tomorrow.
Sigton
Sigton
Sigton
"\\" //returns "\" in js .-.
Saiid
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
No, I know how to backslash escape in both Python and JavaScript, just haven't added it to the Python or JS version of pgs yetImplicit opening will take a minute, and I haven't got around to backslash escaping in either languageWith all of the implicit opening/closing (?) quote stuff done - and backslash escaping?Great, the js interpreter now works perfectly ;DString support has been added, I'll work on arrays tomorrow.
Sigton
Sigton
Sigton"\\" //returns "\" in js .-.
Saiid

Sigton
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Variables are sorted, having a little trouble with pushing to arrays though. It'll be fixed shortly hopefully…
Sigton
Sigton
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Okay, really confused.
Is this some js quirk I don't know about?
Sigton
var a = { "a":0, "b":0, "c":0 } 1 in a // returns true
Sigton
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Okay, really confused.Not sure what interpreter you used, but my console returns that as false.Is this some js quirk I don't know about?var a = { "a":0, "b":0, "c":0 } 1 in a // returns true
Sigton
On a different note, I found out that you can make an if/else statement with no brackets

if (true) console.log(true); else console.log(false);
if(true)console.log("Hello");else console.log("hello");console.log("world!")
Saiid
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Not sure what interpreter you used, but my console returns that as false.I tried again and it printed false.
Saiid
Now I'm really, really confused xD
Sigton
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
xDNot sure what interpreter you used, but my console returns that as false.I tried again and it printed false.
Saiid
Now I'm really, really confused xD
Sigton
Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
It appears that using an if/else statement without brackets also works vertically -
returns the console as
Saiid
if (true) console.log(true); else console.log(!true); console.log("Hello")
true Hello
Saiid
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
It appears that using an if/else statement without brackets also works vertically -Yes, because JS does not care about newlines; it just runs (if there is ambiguity it can be resolved with semicolons - but usually they are optional)returns the console asif (true) console.log(true); else console.log(!true); console.log("Hello")true Hello
Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
ahIt appears that using an if/else statement without brackets also works vertically -Yes, because JS does not care about newlines; it just runs (if there is ambiguity it can be resolved with semicolons - but usually they are optional)returns the console asif (true) console.log(true); else console.log(!true); console.log("Hello")true Hello
Saiid
Saiid
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
@Saiid
Please merge the PR's I've made, they fix bugs with the IDE and update the website to the latest version.
Sigton
Please merge the PR's I've made, they fix bugs with the IDE and update the website to the latest version.
Sigton
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
@SaiidJust did. Also, I invited you as a collaborator with Admin level powers, since I trust you
Please merge the PR's I've made, they fix bugs with the IDE and update the website to the latest version.
Sigton

Saiid
- ScratchMan544
-
Scratcher
100+ posts
PigeonScript - a Golfing Language
-snip-
On a different note, I found out that you can make an if/else statement with no bracketsand, it only supports a single action for both, soif (true) console.log(true); else console.log(false);prints “Hello” to the console, then prints “world!”if(true)console.log("Hello");else console.log("hello");console.log("world!")
Saiid
Yeah. That's a quirk of the original C-like syntax. Control constructs only accept a single “statement”, but wrapping multiple statements in { } makes them be treated by the parser as a single statement. This also means you can have empty loops and things like this:
#include <stdio.h> int /* another quirk of C-like syntax is that you can put comments almost anywhere. */ main() { // copies the input to the output for (char c; (c = getchar()) != EOF; putchar(c)); // this loop has no body, as the trailing semicolon is a single statement that has no effect. }
Last edited by ScratchMan544 (Dec. 1, 2016 01:40:39)
- Discussion Forums
- » Advanced Topics
-
» PigeonScript - a Golfing Language




