GLOBOL: An esoteric language for the whole world

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Prelates, Moderators General

GLOBOL: An esoteric language for the whole world

Postby darkspork » Sat Nov 12, 2011 11:04 pm UTC

One of my professors told me a story about a student of his who defined a function in an interpreter in class and was confused to arrive at home and find the function not defined. Jokingly, I suggested that there should be a language where that can't happen. Since I have a few classes that have rather open ended requirements for big projects, I've decided to invent and create such an esoteric language, then write an interpreter for it. The interpreter isn't quite done yet, but as a graded project, it'll definitely be finished before the end of the semester. It's the first major project I've done using javacc, networking, or databases. However, as I've never really thrown together a language of this scope, I've had a few difficulties with the language definition itself, which is really the one part of this that isn't a graded requirement. I thought I'd post the specs here and see if anyone has any suggestions or comments on how to make it more outrageously silly to use or simply a part of the definition that doesn't make sense. Perhaps you might want to try your hand at writing some code, even though it can't be interpreted quite yet. When I'm done with the project, I'll probably release the code open source, though I'm not sure if I can maintain the necessary server to run it the way it was intended.

PREMISE: GLOBOL is a fantastic language that takes advantage of global variables.
> GLOBOL takes the hassle and confusion out of figuring out scope. No longer need you ask "Which NUMBEROFPICKLES am I looking at right now?"
> GLOBOL avoids case sensitivity issues by ensuring that EVERYTHING IS ALWAYS IN UPPER CASE, and disallows such confusing punctuation as underscores in variable names. This makes variables more clear and prevents the inevitable bug caused by a slight misspelling.
> GLOBOL is dynamically typed, preventing wasted programmer time by typing silly things like "int x;"
> GLOBOL implements pure, system level multithreading to effectively parallelize any task. Threads can run on multiple cores or even multiple servers with ease.
> GLOBOL provides a rich API, allowing a great number of functions to be used without mucking about in "import" statements. Chances are someone wrote the function you want already.
> GLOBOL makes networked programming as easy and natural as anything else.
> GLOBOL code resembles natural language, so can be understood by programmers and non-programmers alike.
> GLOBOL strongly discourages "reinventing the wheel". No function ever needs to be written twice!
> GLOBOL prevents the use of difficult to understand practices, such as recursion, functional programming, or regular expressions.
> GLOBOL uses integers that are almost impossible to mistype for a different number, causing hours of confusion in debugging.
> GLOBOL avoids the use of parenthesis, requiring special software to match them and avoid confusion.

In essence, GLOBOL is roughly what you'd get if you mated the syntax of COBOL with a little bit of Python and forced all variables to be global. I do mean global in the sense that there is (almost) no sense of scope the values are stored on a server somewhere and everyone uses the same pool of variables. If I define COUNTER to be 7, then someone in China decides COUNTER should equal TRUE, the next time I read the value of COUNTER, it will be TRUE.

And now, some actual syntax:

General Syntax Rules
GLOBOL uses Python style indentation.
GLOBOL programs MUST NOT contain lowercase letters AT ALL - not in comments, not in string literals.

Comments
Comments begin with one of the following phrases:
Code: Select all
DID I EVER TELL YOU
IGNORE THIS NEXT PART
SO ANYWAY,
YOU KNOW,
BY THE WAY,
OF COURSE,
INTERESTINGLY ENOUGH,
ERGO

Comments are mostly ignored but MUST FOLLOW the indentation rules. In addition, lines can be indented "children" of comments to make themselves comments.

Variables
Variable names consist of a string containing only UPPERCASE CHARACTERS - no lowercase, no spaces, no underscores.
Variable names must be more than one character long (because those are references)
Variable names cannot be reserved words
Variables are dynamically typed, and can be of any of the following types:
Null
Boolean
Integer
Float
String
Function definition

Variables are evaluated the moment they are seen. Their values are also not cached: the global repository is checked each time the variable is seen. Thus, it is possible for the value of
Code: Select all
ADD MYVARIABLE TO MYVARIABLE

to be an odd number.

Literals
Null literals are declared with BLANK, CLEAR, NOTHIN, or ZILCH. There is no difference between these words whatsoever.

Boolean literals are declared with YES, YUP, NO, NOPE, or MAYBE. YES and YUP evaluate as true, NO and NOPE evaluate to false, and MAYBE evaluates to true or false randomly when it is encountered by the parser.

Integer literals can be declared as a sequence of digits, like
Code: Select all
ONE TWO THREE FOUR FIVE SIX SEVEN

or can be declared with natural English phrases:
Code: Select all
ONE MILLION TWO HUNDRED THIRTY FOUR THOUSAND FIVE HUNDRED SIXTY SEVEN

The understood words are:
ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE TEN ELEVEN TWELVE THIRTEEN FOURTEEN FIFTEEN SIXTEEN SEVENTEEN EIGHTEEN NINETEEN TWENTY THIRTY FORTY FIFTY SIXTY SEVENTY EIGHTY NINETY HUNDRED THOUSAND MILLION BILLION TRILLION

Similarly, floating point numbers must be declared as a sequence of digits with the addition of the word POINT:
Code: Select all
THREE POINT ONE FOUR ONE FIVE NINE TWO SIX FIVE THREE FIVE NINE


String literals go between beautiful ASCII art quote marks.
Code: Select all
``HELLO WORLD''

Escape characters cannot be used to avoid confusion.

Assignment
Variables are assigned with the IS NOW operator:
Code: Select all
NUMBEROFPICKLES IS NOW SEVENTEEN

Assignments must be used as their own statements and cannot be part of larger expressions
Code: Select all
THEULTIMATEANSWER IS NOW MULTIPLY SIX BY NINE
is valid, while
Code: Select all
BARK THEULTIMATEANSWER IS NOW FORTY TWO
is not.

Comparison
There are three comparison operators:
Code: Select all
EXPRESSIONONE IS LIKE EXPRESSIONTWO
(returns true if the two expressions have the same type)
Code: Select all
EXPRESSIONONE IS EXPRESSIONTWO
(returns true if the two expressions have the same type and value)
Code: Select all
EXPRESSIONONE IS BIGGER THAN EXPRESSIONTWO
(returns true if EXPRESSIONONE > EXPRESSIONTWO. For numbers, their values are compared. For strings, their lengths. In other cases, this is an error)

Flow Control
Code: Select all
IF EXPRESSION
  DO STUFF
  CONTINUE DOING STUFF

IF EXPRESSION
  DO STUFF
OTHERWISE
  DO MORE STUFF

AS LONG AS EXPRESSION
  DO STUFF

These examples do roughly what you think they do. AS LONG AS is how you say WHILE and OTHERWISE is ELSE. Expressions are evaluated to booleans according to the following rules:
Null - false
Booleans - their value
Numbers - true if not zero
Strings - true if not the empty string
Functions - true

Function Calls
Functions are meant to appear as close to natural English as possible.

Code: Select all
FUNCTION ARGUMENT SEPARATOR ARGUMENT SEPARATOR ARGUMENT SEPARATOR ARGUMENT

All functions must have at least one argument. This is a consequence of the following:
There are no parenthesis or anything to indicate association, so the innermost function will take all arguments after it. This puts a damper on functional programming for people who try to escape the clutches of global scope.
There is also no "order of operations".
FUNCTION is any variable name or builtin function name. It is an error to call a variable that is not of type function declaration.
SEPARATOR is any of:
Code: Select all
AND OR WITH BY TO FROM ,

Different separators serve no purpose.

All of the following examples evaluate to 17:
Code: Select all
ADD FOUR AND THIRTEEN
ADD TWO, TWO, THREE AND TEN
ADD SEVEN AND MULTIPLY FIVE BY TWO
MULTIPLY SEVENTEEN BY SUBTRACT TWO FROM THREE


The following built in functions are available:
For numbers
ADD (two or more arguments)
(X+Y)
SUBTRACT X FROM Y
(Y-X)
MULTIPLY (two or more arguments)
(X*Y)
DIVIDE X BY Y
(X/Y)

Arguments are converted to strings
ADD (two or more arguments)
(X+Y) (concatenation)
BARK (one or more arguments)
STDOUT.println (concatenates arguments)
SQUEAK (one or more arguments)
STDOUT.print (concatenates arguments)
SQUEAL (one or more arguments)
STDERR.println (concatenates arguments)

Arguments are converted to booleans
BOTH (two or more arguments)
(X&&Y)
EITHER (two or more arguments)
(X||Y)
NOT X
(!X)

It is an error to call a function with the wrong number of arguments.

References
References are the one exception to the rule of global scope. They are used in function definitions to stand in for the arguments. Each is represented by a single upper case letter, so there are only TWENTY SIX of them. They are set by calling the function and local to that function definition body. They are also constant, so you can't use them to change variable names.

Function Definition
Code: Select all
HOW TO FUNCTION ARGUMENT SEPARATOR ARGUMENT
  DO STUFF
  THE ANSWER IS WHATEVER

ARGUMENTs must be references, and SEPARATORs are the same as for function calls.
There must be at least one argument
FUNCTION is the name of the function.
THE ANSWER IS is the return statement.

Code: Select all
HOW TO SQUARE X
  THE ANSWER IS MULTIPLY X BY X

HOW TO AVERAGE X AND Y AND Z
  HOPEFULLYUNIQUELYNAMEDSUMVARIABLE IS NOW ADD X, Y AND Z
  THE ANSWER IS DIVIDE HOPEFULLYUNIQUELYNAMEDSUMVARIABLE BY THREE


Exceptions
Code: Select all
I CAN'T HEAR YOU              (Used a lowercase character)
WHERE'S MY MOMMY?             (Network error)
THAT MAKES NO SENSE           (Generic syntax error)
I FORGET                      (Out of memory error)
I CAN'T DO THAT TO THAT       (Type error)
STOP VERBING NOUNS            (Called a non-function variable as a function)
THIS ISN'T LISP               (Tried to use parenthesis)
WHY ARE YOU USING RECURSION?  (Stack overflow)
YOU FAIL AT MATH              (Division by zero)
TOO MUCH INFORMATION          (Too many arguments)
NOT ENOUGH INFO               (Too few arguments)


Exception handling
HA HAHAAA HA HA HAAA HA HA HAHAHAHAAAHAHAHAHAAAHAHAHAA HAHAAAHAHAAAAHAHAHAAHAHAHAAAAHAHAHAHAHAA...
no. Any error halts the program.

Examples
Code: Select all
DID I EVER TELL YOU HOW TO USE THIS LANGUAGE?
  I SUPPOSE I DIDN'T. WELL, HERE ARE SOME EXAMPLES
  OF HOW TO USE THE LANGUAGE. DON'T ACTUALLY RUN
  THIS FILE, THOUGH. IT CONTAINS TWO INFINITE
  LOOPS AND WON'T GET VERY FAR. ALSO, IT WILL
  TROLL ANYONE TRYING TO USE THE SQUARE FUNCTION.
  YOU DON'T WANT TO DO THAT, DO YOU? ANYWAY,
  MOVING SWIFTLY ALONG...

HELLOWORLD IS NOW ``HELLO WORLD''
BARK HELLOWORLD

BY THE WAY, IT'S POSSIBLE AND/OR VERY LIKELY
  THAT THEULTIMATEANSWER WOULD BE
  42 BY THE TIME IT WAS PRINTED
THEULTIMATEANSWER IS NOW MULTIPLY SIX BY NINE
AND THEN BARK ADD ``THE ULTIMATE ANSWER TO LIFE, THE UNIVERSE, AND EVERYTHING IS '' TO THEULTIMATEANSWER

YOU KNOW, THIS IS HOW YOU WOULD TROLL PEOPLE
WHILE YES
  HOW TO SQUARE X
    BARK ``U MAD ?''
    THE ANSWER IS ``JOHN MADDEN''
  BARK ``THEY MAD''

BY THE WAY, THIS IS HOW YOU WOULD DEFINE IT CORRECTLY
HOW TO SQUARE X
  THE ANSWER IS MULTIPLY X BY X

OF COURSE, THIS MIGHT TROLL PEOPLE MORE
WHILE YES
  SQUARE IS NOW ``JOHN MADDEN''

INTERESTINGLY ENOUGH, THIS CODE DOES SOMETHING
WHILE YES
  FOOISARESERVEDWORD IS NOW FOOISARESERVEDWORD
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby cemper93 » Sat Nov 12, 2011 11:57 pm UTC

First: AWESOME! Definitely one of the funnier ideas for an esoteric language.

Some critique/suggestions:
AND THEN BARK ADD ``THE ULTIMATE ANSWER TO LIFE, THE UNIVERSE, AND EVERYTHING IS '' TO THEULTIMATEANSWER

IMHO this doesn't really resemble natural language. The way it's written here appears to yield "SIXTYNINETHE ULTIMATE ANSWER TO LIFE, THE UNIVERSE, AND EVERYTHING IS " rather than "THE ULTIMATE ANSWER TO LIFE, THE UNIVERSE, AND EVERYTHING IS SIXTYNINE". "ADD A TO B" should mean B + A, not A + B.

ADD SEVEN AND MULTIPLY FIVE BY TWO

Maybe rather "ADD SEVEN AND THE RESULT OF MULTIPLY FIVE BY TWO"? It's closer to natural language and bloats the code even more, only for a distinction between calling something as a function and calling something as a procedure, which doesn't even have any advantage. Extra fun is that you don't even have to make RESULT a reserved keyword, as the keyword is "THE RESULT OF". This allows for lines like "RESULT IS NOW THE RESULT OF RESULT THE RESULT OF RESULT" (= "RESULT := RESULT(RESULT)").

Oh, and I request some sort of list or array structure (you could index with "WHATEVER IS AT" or the like).

BTW I was really staggered by the fact that there doesn't yet exist a language called GLOBOL. Sounds very legit.
Hello good friend.<br>Thank you for the kind insight. To gain free XBOX, please click this link <a href="http://forums.xkcd.com/viewtopic.php?f=53&t=37971">for m&ouml;re information visit our website.</a><br>Also more can be found.<br>Best regard
User avatar
cemper93
 
Posts: 183
Joined: Sun Feb 20, 2011 2:35 pm UTC
Location: `pwd`

Re: GLOBOL: An esoteric language for the whole world

Postby Ankit1010 » Sun Nov 13, 2011 12:58 pm UTC

I THINK THIS LANGUAGE NEEDS MORE EXCLAMATION POINTS!!! "THE ANSWER IS 42!!". I say enforce a minimum of 2 exclamation points after every 3rd statement, except the ones divisible by 9 too, which causes the program to halt immediately... (or something fun like that).

Also, !!!OMGWTFBBQLULZ!!! at the start and end of every program.
Ankit1010
 
Posts: 135
Joined: Fri Feb 11, 2011 11:32 am UTC

Re: GLOBOL: An esoteric language for the whole world

Postby RoadieRich » Sun Nov 13, 2011 3:18 pm UTC

Next, GLOOP: The object orientated add-on to GLOBOL.

All class names start with CLASS, to distinguish them from variables (think C's struct keyword). You can't remove methods from a class, only add or overwrite. Method calls without arguments are indistinguishable from property lookups, and properties are implemented as implicit getter and setter methods.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Mon Nov 14, 2011 1:43 am UTC

cemper93 wrote:MHO this doesn't really resemble natural language.

Hmmm. I like the idea, but not the exact implementation. It falls against an important distinction in that the conjunctions themselves don't matter. Syntactiacally, there is no difference between:
Code: Select all
ADD X AND Y
ADD X OR Y
ADD X WITH Y
ADD X TO Y
ADD X FROM Y
ADD X, Y

and allows for ridiculous constructs like
Code: Select all
EITHER A OR B AND C FROM D AND E

which simply returns true if any of A, B, C, D, or E hold true.
Though your examples have given me a few ideas, mostly removing the TO and FROM separators and replacing ADD, SUBTRACT, MULTIPLY, and DIVIDE with SUM, DIFFERENCE, PRODUCT, and QUOTIENT and adding a REMAINDER function that does what you think it does, thus fitting with the needless verbosity theme of some other aspects of the language. In addition, I'd add a few words that are ignored by the parser, including THE and OF, so

Code: Select all
MULTIPLY SEVENTEEN BY SUBTRACT TWO FROM THREE

could instead be written
Code: Select all
THE PRODUCT OF SEVENTEEN AND THE DIFFERENCE OF THREE AND TWO



cemper93 wrote:Oh, and I request some sort of list or array structure (you could index with "WHATEVER IS AT" or the like).

I've been debating that one in my mind. It won't be in the first version, but is a good idea nonetheless. If anything, I'd take a page from Perl and Tcl, as I'm not particularly fond of the way either of those handle arrays.

Ankit1010 wrote:I THINK THIS LANGUAGE NEEDS MORE EXCLAMATION POINTS!!! "THE ANSWER IS 42!!". I say enforce a minimum of 2 exclamation points after every 3rd statement, except the ones divisible by 9 too, which causes the program to halt immediately... (or something fun like that).

Also, !!!OMGWTFBBQLULZ!!! at the start and end of every program.

I like the idea of exclamation points being important, but I've been trying to avoid what seems like forced kludge into the language. In my first draft of the language, I took a page from INTERCAL and added complex rules about when to use the word PLEASE. In the end, it felt sort of tacked on. For example, you could make a kludgy, hard to use version of Ruby by requiring all function names to be latin verbs, all variable names to be characters from the works of Douglas Adams, all functions to have three arguments, prohibiting method chains longer than six or shorter than four, comments to be in iambic pentameter and only on prime numbered lines...

I want this language to be annoying and stupid to use not because of irritating rules you could tack on to any language, but because of two inherent, glaringly stupid design flaws in its very foundation:
1) All variables are global.
2) Code must look like natural language.

RoadieRich wrote:Next, GLOOP: The object orientated add-on to GLOBOL.

All class names start with CLASS, to distinguish them from variables (think C's struct keyword). You can't remove methods from a class, only add or overwrite. Method calls without arguments are indistinguishable from property lookups, and properties are implemented as implicit getter and setter methods.

XD If anything, the OOP should feel as tacked on if not more than it does in C++.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby jareds » Mon Nov 14, 2011 2:51 am UTC

This is hilarious. For esoteric language design, I strongly agree with the idea of taking one bad idea and running with it.

I do have one suggestion. Make variable caching unspecified rather than nonexistent. My suggested implementation would then be to decide on each variable access whether to refresh the cache, so you can rate limit it but it still might happen at any time, even within a single expression. I'm afraid that nonexistent caching will make the language agonizingly slow: not just thousands of times slower than compiled code, but hundred of millions of times slower. Think about it: if you have 100 ms latency to the server, this will be very much slower than vacuum tubes. Certainly no one expects esoteric languages to be fast, but with this you want it usable enough that people will mess around with it enough to pollute the namespace.
jareds
 
Posts: 405
Joined: Wed Jan 03, 2007 3:56 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby RoadieRich » Mon Nov 14, 2011 4:11 am UTC

I;ve been thinking about GLOOP...

Code: Select all
HERE, WE INTRODUCE A NEW SYNTACTIC CHARACTER, AND A NEW STYLE OF COMMENT, PURELY FOR THE SAKE OF IT
{CLASS NODE
    HERE, HAS PROPERTY DOES EXACTLY WHAT IT SOUNDS LIKE
    HAS PROPERTY NEXT
    HAS PROPERTY DATA
    HERE, CAN INTRODUCES A METHOD, IN A SIMILAR WAY TO DEFINING A FUNCTION
    CAN CONSTRUCT ME
        IT IS INTERESTING THAT THIS METHOD IS CALLED CONSTRUCT: THAT IS A SPECIAL NAME, ALONG WITH DISINTEGRATE.
            NEITHER CAN TAKE ANY ARGUEMENTS, OR BE CALLED EXPLICITLY.
        
        HERE, ME IS AN ORDINARY VARIABLE, BUT THE NAME IS ENFORCED

        DATA IN ME IS NOTHING

        HERE, IN IS ANOTHER NEW KEYWORD, USED TO ACCESS PROPERTIES.
        OF COURSE, ALL PROPERTY AND METHOD ACCESSESS MUST BE QUALIFIED 
            WITH AN INSTANCE NAME


{CLASS LINKEDLIST
    HAS HIDDEN PROPERTY HEAD
    HERE, YOU CAN SEE HOW DATA HIDING WORKS - LITERALLY.
    CAN GETLAST FROM ME
        LAST IS NOW HEAD IN ME
        AS LONG AS NEXT IN LAST IS NOT NOTHING
            LAST IS NOW NEXT IN LAST
        THE ANSWER IS LAST
    CAN APPEND ME WITH DATAVALUE
        LAST IS NOW GETLAST FROM ME
        HERE, FROM IS YET ANOTHER NEW KEYWORD, USED TO ACCESS MEMBERS. METHOD CALLS ARE EXACTLY THE SAME AS FUNCTION CALLS, 
            EXCEPT THE FIRST ARGUMENT MUST BE AN INSTANCE
        NEXT IN LAST IS NOW NEW NODE
        DATA IN NEXT IN LAST IS NOW DATAVALUE
}
HERE IS THE FINAL NEW KEYWORD, NEW, TO INSTANTIATE THE NICE SHINY CLASS YOUVE JUST MADE
    IF YOU WERE PAYING ATTENTION, YOU WILL NOTICE THIS IS NOT THE FIRST PLACE IT HAS BEEN USED.
LIST IS NOW NEW LINKEDLIST
APPEND LIST WITH ONE
APPEND LIST WITH TWO
STDOUT DATA IN GETLAST FROM LIST
 


Three new exceptions are added: DOES NOT QUACK, if the class does not have the method or property you're trying to access, NOT EVEN A BIRD if you try to use GLOOP keywords on GLOBOL vanilla types, and HAS OF WORMS for misusing a property as a method or vice-versa.

Also, one new object is created, for convenient testing: NAO (not an object). This magic object accepts any method and property access by magic, and always returns NAO. Instantiating it or accessing any member issues a system-modal dialogue box to let you know.

Edit: DS, I hope you don't mind me defining addons to your language...
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Mon Nov 14, 2011 6:11 am UTC

jareds wrote:Make variable caching unspecified rather than nonexistent... [otherwise] this will be very much slower than vacuum tubes.

Hmmm. You have a good point there. I'll have to see how well it works in practice. I was prepared for it to be slow, but this might just be more than I bargained for. If anything, I'll probably implement some kind of special behavior instead of just random. What if setting the value of a variable kept it in a cache for a second or two? If anything, I don't want to break multithreading (I.E. forked processing by running parallel programs on one or more hosts). Actually, that feature might add a second or two of usefulness to the language, allowing a clever enough person to write marginally useable code. Even cached, all variables still have global scope.

In any case, I suppose caching would be necessary anyway for more than about three people to ever use the language on one server.

RoadieRich wrote:I;ve been thinking about GLOOP... DS, I hope you don't mind me defining addons to your language.

Not at all. I like the idea and GLOBOL was never meant to be object oriented, but if anything, I can make an analogy to C/C++ and how much of a disaster that always feels like when I code in it. Clever error messages too.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby jareds » Mon Nov 14, 2011 7:09 am UTC

darkspork wrote:Hmmm. You have a good point there. I'll have to see how well it works in practice. I was prepared for it to be slow, but this might just be more than I bargained for. If anything, I'll probably implement some kind of special behavior instead of just random. What if setting the value of a variable kept it in a cache for a second or two? If anything, I don't want to break multithreading (I.E. forked processing by running parallel programs on one or more hosts). Actually, that feature might add a second or two of usefulness to the language, allowing a clever enough person to write marginally useable code. Even cached, all variables still have global scope.
Well, randomness encompasses more than a fixed probability of checking the cache. You could make a random decision based strictly on time, not on how often the variable is accessed: e.g., a Poisson process. I think the ability of the user to anticipate whether or not the cache will be used should be limited. For multi-threading, you could allow clients to subscribe to variables, so that they'd receive updates based on a push model rather than a pull model, limiting the need for rate-limiting, although writes would still need to be rate-limited pretty severely.
jareds
 
Posts: 405
Joined: Wed Jan 03, 2007 3:56 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Mon Nov 14, 2011 7:31 am UTC

jareds wrote:Well, randomness encompasses more than a fixed probability of checking the cache. You could make a random decision based strictly on time, not on how often the variable is accessed: e.g., a Poisson process. I think the ability of the user to anticipate whether or not the cache will be used should be limited. For multi-threading, you could allow clients to subscribe to variables, so that they'd receive updates based on a push model rather than a pull model, limiting the need for rate-limiting, although writes would still need to be rate-limited pretty severely.

Hmmm. What if I incorporated an "expiration time" into the networking protocol? Maybe have the server determine how long the variables should be cached based on its own current load or whatever else it determines? That still gives the server some control over its own load without letting it be predictable to the programmers.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby jareds » Mon Nov 14, 2011 9:06 am UTC

darkspork wrote:Hmmm. What if I incorporated an "expiration time" into the networking protocol? Maybe have the server determine how long the variables should be cached based on its own current load or whatever else it determines? That still gives the server some control over its own load without letting it be predictable to the programmers.

Bearing in mind that this discussion is way overkill (any sort of caching will let you run it at your school), there's always the time-honored technique of re-implementing half of TCP using UDP. I'm partly serious: your application requires flow control but not reliable and in-order packet delivery, in which case it is common to use UDP with flow control at the application level (VoIP, etc.).

However, I think your idea is better here, where the main focus should be the language. Remember, though, that there are two important factors for controlling load: read and writes; and setting the expiration time when a variable is read only controls one direction. You'll also want to be able to tell the clients how often to send a full update of writes (although the client might need to go even slower based on its own network limitations).
jareds
 
Posts: 405
Joined: Wed Jan 03, 2007 3:56 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby WarDaft » Mon Nov 14, 2011 7:18 pm UTC

Then we can have FLOBOL, the radical splinter faction that incorporates functional programming into a language specifically designed to avoid the complexities of functional programming. First, they'll have to make everything immutable. They will point out that this will instantly solve your caching problem, the cache is good forever!
Second, we add the keyphrases "WHEN I SAY" and "I REALLY MEAN", for function declaration. Since everything is already in scope and immutable, we can just use run time string rewriting for function application, that'll work, right? Also, since prolog is a really cool and awesome language, we should follow in its footsteps a bit too. Functions of different arity should obviously be different functions.

Thirdly...


Actually I'm not sure more is really required.
All Shadow priest spells that deal Fire damage now appear green.
Big freaky cereal boxes of death.
User avatar
WarDaft
 
Posts: 1561
Joined: Thu Jul 30, 2009 3:16 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby RoadieRich » Mon Nov 14, 2011 9:46 pm UTC

WarDaft wrote:radical splinter faction

Begone with you, we don't want your type here.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: GLOBOL: An esoteric language for the whole world

Postby userxp » Tue Nov 15, 2011 11:20 pm UTC

Hmm, this reminds me of a similar esoteric language I saw once.

darkspork wrote:I want this language to be annoying and stupid to use not because of irritating rules you could tack on to any language, but because of two inherent, glaringly stupid design flaws in its very foundation:
1) All variables are global.
2) Code must look like natural language.


Then my suggestion is that you drop the ALL CAPS ALL THE TIME requirement. IMHO It just makes it hard to read code. Instead, perhaps you could enforce some more natural rules of capitalization and punctuation. For example:

Code: Select all
Helloworld is now: ``Hello, world!''.
Bark Helloworld.

Theultimateanswer is now Multiply Six by Nine.
And then Bark Add ``The ultimate answer to life, the universe, and everything is...'' to Theultimateanswer.

While Yes:
  how to Square X:       (by the way, I'm not sure if there should be a capital here after the colon. Also this is a valid comment.)
    Bark ``U mad?''.     (did I ever tell you correct grammar is not enforced? Yet...)
    The Answer is ``John Madden''?
  Bark ``They mad!''.

(By the way, this is how you would define it correctly:)
How to Square x:
  the Answer is Multiply X by X.

(Of course, this might troll people more:)
While yes:
  Square is now ``John Madden''.

(Interestingly enough, this code does something:)
While Yes:
  Fooisareservedword is now Fooisareservedword.


Also, the comparisons are confusing. "Is expressionone bigger than expressiontwo?" is much more understandable than "expressionone is bigger than expressiontwo?" (though maybe harder to implement).


The main point of this programming language is that everyone interferes with everyone else. Thus, the more people use it, the more Fun! it is to program in, so you should make it easy.

darkspork wrote:Exception handling
HA HAHAAA HA HA HAAA HA HA HAHAHAHAAAHAHAHAHAAAHAHAHAA HAHAAAHAHAAAAHAHAHAAHAHAHAAAAHAHAHAHAHAA...
no. Any error halts the program.

Or perhaps... any error continues silently :twisted: .
userxp
 
Posts: 436
Joined: Thu Jul 09, 2009 12:40 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Wed Nov 16, 2011 4:46 am UTC

userxp wrote:Hmm, this reminds me of a similar esoteric language I saw once.

Oh, poo. I thought the concept was original. Then again, that feels more C like.

userxp wrote:Then my suggestion is that you drop the ALL CAPS ALL THE TIME requirement.

It started as a parody of older languages, particularly COBOL because TRYING TO READ COBOL CODE ALWAYS FEELS LIKE THE COMPUTER IS SHOUTING AT YOU. It feels like a valid point, but at this point it's an arbitrary decision I made. Besides, I know a LARGE NUMBER OF PEOPLE WHO DO NOT UNDERSTAND WHAT THE PURPOSE IS OF THAT RECTANGULAR KEY NEXT TO THE ``A'' KEY AND I WANTED TO OPEN UP THE LANGUAGE TO THEM. THEY COULD PROBABLY USE SOME EXTRA COMPUTER SKILLS, ESPECIALLY SINCE I GET ALL THOSE EMAILS FROM THEM AT WORK ABOUT HOW THEY WANT ME TO FIX THINGS FOR THEM.

userxp wrote:"Is expressionone bigger than expressiontwo?" is much more understandable than "expressionone is bigger than expressiontwo?"

Yes, but it makes sense if you use it like this:
Code: Select all
IF NUMBEROFPICKLES IS BIGGER THAN SEVEN


userxp wrote:Or perhaps... any error continues silently :twisted: .

Oh, that would be so evil.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby jareds » Wed Nov 16, 2011 9:41 am UTC

userxp wrote:Or perhaps... any error continues silently :twisted: .

You don't even need an esoteric language for that!
Code: Select all
On Error Resume Next
jareds
 
Posts: 405
Joined: Wed Jan 03, 2007 3:56 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby Yakk » Wed Nov 16, 2011 9:21 pm UTC

Pre-error handing:
WHEN SOMETHING GOES WRONG PLACE THE PROBLEM INTO ENVELOPE

Post-error handling:
IF SOMETHING WENT WRONG ...
?
...

I sort of like the idea of having a temporal syntax in the language. Ie, you can ask for a variable's value to be after a previous point in the program has modified the global state.

This could be the "AFTER THAT" keyword. Any line with AFTER THAT is guaranteed to read data from after the previous line's results where sent to the global server?
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10370
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Tue Nov 22, 2011 1:10 am UTC

Alright. Status update time: I've designed most of the network protocol and I have a simplified version of the interpreter ready. It is not yet Turing Complete. I'm stuck on exactly how to parse Python style indentation from within Javacc, but I have a few rough ideas, at the very least. Here's the network protocol:

Code: Select all
GLOBOL interpreters communicate with the server by sending messages. Messages may contain zero or more requests, and the connection is closed at the end of a message. The default port for communication is TCP port 42367. (though I might change this to allow UDP as well, as the protocol should be able to support it.)

Tokens in a message are separated by single spaces.

A message contains: PROTOCOL_VERSION MESSAGE_ID (REQUEST)* DONE

PROTOCOL_VERSION
  An integer. Current version is 1.

MESSAGE_ID
  Generated by client according to no specified rules. Must fit in a 32 bit unsigned integer.

REQUEST
  May be any of the following:
 
  GET VARIABLE_NAME
    Sent by client to request the value of a variable. Server must respond with an equivalent SET request
 
  SET VARIABLE_NAME VARIABLE_DATA
    Sent by client/server to indicate the current value of VARIABLE_NAME
 
  (NOT SUPPORTED in protocol version 1) CACHE TIME_IN_MILLISECONDS
    Sent by server. Client should wait this much time before contacting server again, if possible.
 
  FAIL REASON
    Sent by server to indicate an error. REASON can be any contiguous string of alphanumeric characters (or underscores),
    but the following are officially recognized by this protocol:
   
    VERSION     Protocol versions don't match
    REQUEST     Bad request
    TIMEOUT     Took too long (10 second timeout maybe? This is up to the server.)
    IO          The stream was interrupted or something
    BUSY        The server is overloaded at the moment
    EPIC        I suppose the best analogy for this one is an HTTP 500.
 
DONE
  Sent to indicate that the transmission is done. A trailing space or newline is allowed but not required.

VARIABLE_DATA
  First character is always a single character indicating type.
  It is followed by a space. The rest depends on the variable type:
 
  null: N
  boolean: B (TRUE|FALSE)
  ints: I \d+
  floats: F \d+(\.\d+)?([eE][+\--]\d+)?
  strings: S [length in bytes as \d+] [that many bytes of string data]
  functions: (NOT SUPPORTED in protocol version 1) E [length in bytes] [variable list] [source code]*

* I haven't quite figured out exactly what constitutes "source code" and probably won't until I get the implementation barely working, so functions are omitted from protocol version 1

Example sessions:

Client: 1 413 GET NUMBEROFPICKLES DONE
Server: 1 413 SET NUMBEROFPICKLES I 7 DONE

Client: 1 414 SET GREETING S 10 HELLOWORLD DONE
Server: 1 414 DONE

Client: 1 415 SET VAR S THIS DOES NOT FOLLOW THE PROTOCOL DONE
Server: 1 415 FAIL PROTOCOL DONE

Client: 18 416 GET PICKLES DONE
Server: 1 416 FAIL VERSION DONE

Client: 1 417 SET MAIL B FALSE SET GREETING S 12 GOOD MORNING SET MAX E 79 X Y
  IF X IS BIGGER THAN Y
    THE ANSWER IS X
  OTHERWISE
    THE ANSWER IS Y SET ULTIMATEANSWER I 42 DONE
Server: 1 417 DONE

Client: 1 418 GET COUNTER GET GREETING SET BUSHELS F 6.12 GET PI DONE
Server: 1 418 SET COUNTER I 16 SET GREETING S 6 SHALOM SET PI F 3.14159 DONE

Client: 1 419 GET CHEESEBURGERINVENTORY SET CHOLESTEROL I 221 DONE
Server: 1 419 SET CHEESEBURGERINVENTORY S 43 THERE R NO CHEEZBURGER LEFT
CUZ I ATE EM :3 DONE


I have a simple server up and running, though I'm not proud of the code enough to show it off yet. PM me if you really want its IP address, as I'd rather not just dump that out in public for now.

Yakk wrote:Pre-error handing:
WHEN SOMETHING GOES WRONG PLACE THE PROBLEM INTO ENVELOPE

I like this idea... nest code inside it and you have a modern try {} catch statement.
Of course the options would be limited to things that are stupid and don't give you the modern benefits of an Exception object:
WHINE (print error message, continue in block)
COMPLAIN (print error message, continue outside block)
GIVE UP (continue outside block)
TRY AGAIN FROM THE TOP (repeat the block)
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby WarDaft » Wed Nov 23, 2011 9:51 pm UTC

Hmm, you should allow arbitrary code execution in the 'catch' spot, but only let those specific statements actually know anything about the error.

That way, you can have:
IF SOMETHING WENT WRONG THEN JUST ORDER PIZZA INSTEAD
All Shadow priest spells that deal Fire damage now appear green.
Big freaky cereal boxes of death.
User avatar
WarDaft
 
Posts: 1561
Joined: Thu Jul 30, 2009 3:16 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby Derek » Thu Nov 24, 2011 4:50 am UTC

Why have references for function arguments? Why not just have the function automatically assign the arguments to normal named variables. This removes the need for a distinction between references and variables and further increases the difficulty of writing a working program. This also has the added bonus of making recursion extremely difficult (a recursive call would overwrite the original parameters). In fact, why not just go all the way and completely eliminate recursion. Then you don't even need a call stack. Recursion tends to confuse new programmers anyways, so this will make your language more friendly to beginners.
Derek
 
Posts: 1485
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Fri Dec 02, 2011 7:21 am UTC

OK I thought I'd post an update on this. I tried to do so last week, but the fora was broken or something and wouldn't accept my posts.

I have implemented
> Server
> Basic caching (The rule that seems to be working is "precache any necessary variables before processing a line of code, push all changes and drop the cache if Math.random()*10000 < millisecondsSinceLastPush")
> Natural syntax for integers (holy crap, that was difficult and annoying!)
> Most of the Python style indentation stuff (though I'm having a bit of trouble with multiple dedents, as in this example:)
Code: Select all
WHILE NUMBEROFPICKLES IS BIGGER THAN ZERO
  IF THE REMAINDER OF NUMBEROFPICKLES AND TWO IS ZERO
    BARK NUMBEROFPICKLES, `` IS EVEN''

INTERESTINGLY ENOUGH, THIS FAILS BECAUSE IT CAN'T FIGURE OUT THAT IT DEDENTED TWICE

> Strangely enough, not comments
> Every other language construct as defined other than user-defined functions (declaration and invocation, I'm afraid...)

And I have come up with an extra reserved word here or there:

BAZILLION, KAJILLION, KAJILLIONTH - maximum integer, maximum float, epsilon on a float. These values are, at present, based on Java's long and double datatypes, but are subject to change by implementation of server, client, or whatever else may come.

One of my CS professors suggested adding the following feature, but I'm not entirely sure how/if they would work:

LOCK variable - Prevents other people from changing the value of the specified variable
UNLOCK variable - Take a guess what this does.

Any thoughts? It feels like it'dn't add any particular merit, and there'd need to be SOME kind of expiration policy in place, lest the entire namespace be constantized and the bubbly, unpredictable nature boil away.

Derek wrote:Why not just have the function automatically assign the arguments to normal named variables. This removes the need for a distinction between references and variables and further increases the difficulty of writing a working program.

eeeh. I'd thought about it before. It pushes it far beyond the threshold of utter unusability, leaving there no point in functions at all. It's bad enough that two people may write slightly different versions of a SQUAREROOT function, but it's even MORE useless when only ONE PERSON ON THE PLANET can USE the SQUAREROOT function at a time.


WarDaft wrote:Hmm, you should allow arbitrary code execution in the 'catch' spot, but only let those specific statements actually know anything about the error.

That way, you can have:
IF SOMETHING WENT WRONG THEN JUST ORDER PIZZA INSTEAD


Maybe something like this?

Code: Select all
function WHEN SOMETHING GOES WRONG
  error-prone code


where the function in question would be passed the error message as a string?

Code: Select all
SQUEAL WHEN SOMETHING GOES WRONG
  THIS IS NOW THE PRODUCT OF ``BETTY CROCKER'' AND ``CORPORATE GREED''

might print something like:
I CAN'T PRODUCT TEXT AND TEXT

I like the idea of handling exceptions especially if it's only a marginal improvement over an unconditional halt

In addition, I've thought about adding a FORK command but that'd require some stipulation about only allowing it in the main body, as allowing remote code execution by untrusted sources is always an activity that should be as limited as possible.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby RoadieRich » Fri Dec 02, 2011 9:22 am UTC

darkspork wrote:LOCK variable - Prevents other people from changing the value of the specified variable
UNLOCK variable - Take a guess what this does.

The other option is to make the lock global, so no one (including yourself) can modify the variable, making constants possible - within the usual GLOBOL limitations, of course.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: GLOBOL: An esoteric language for the whole world

Postby jareds » Fri Dec 02, 2011 12:15 pm UTC

darkspork wrote:LOCK variable - Prevents other people from changing the value of the specified variable
UNLOCK variable - Take a guess what this does.
This seems to miss the point of GLOBOL.
jareds
 
Posts: 405
Joined: Wed Jan 03, 2007 3:56 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby Yakk » Fri Dec 02, 2011 1:03 pm UTC

So, you want locks and unlocks?

LOCK variable1 WITH key
will lock the variable1 with the variable key -- placing a cryptographic lock data in the key variable.
UNLOCK variable1 WITH key
unlocks variable1 using the cryptographic lock data stored in key.

When a variable is locked, all access to the variable halts your program until it is unlocked (other than UNLOCK).

If key does not contain the cryptographic lock data, or variable1 isn't locked, UNLOCK waits until it does have the lock data or the variable is locked to avoid requiring messy error handling code. UNLOCK returns only upon success. Alternatively, it could blindly apply the unlocking algorithm, and generate gibberish if the inputs are gibberish.

If we want to keep the bubbly nature, we can have START BEING CAREFUL and STOP BEING CAREFUL commands. The "halt when you try to access a locked variable" then only occurs in a BEING CAREFUL block -- otherwise, you can freely modify variable1. Such an act effectively unlocks variable1, as the data stored in variable1 is what is locked.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10370
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: GLOBOL: An esoteric language for the whole world

Postby WarDaft » Fri Dec 02, 2011 2:38 pm UTC

Guys, you're going about this all wrong.

You can't confuse people by making locks apply to specific things, or using cryptographic protocols as atomic instructions!

Just have a LOCK variable, when LOCK is FALSE, variables can be changed, when LOCK is TRUE, they can't. Simple!
All Shadow priest spells that deal Fire damage now appear green.
Big freaky cereal boxes of death.
User avatar
WarDaft
 
Posts: 1561
Joined: Thu Jul 30, 2009 3:16 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby Meem1029 » Fri Dec 02, 2011 8:04 pm UTC

Also, I feel like it would be very fitting for this language to have a LOCK command, but not tie it to any specific program. If someone wants to UNLOCK a variable, why should they have to be the one who locked it?
cjmcjmcjmcjm wrote:If it can't be done in an 80x24 terminal, it's not worth doing
Meem1029
 
Posts: 378
Joined: Wed Jul 21, 2010 1:11 am UTC

Re: GLOBOL: An esoteric language for the whole world

Postby Yakk » Fri Dec 02, 2011 8:37 pm UTC

Hence my idea. You store the method to unlock in another, global variable.

(My idea is also insane, because it locks all access to the variable. Which means it can be used for multi-process synchronization rather than memory protection... which makes read-only a matter of convention, rather than enforced by the language.)
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10370
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: GLOBOL: An esoteric language for the whole world

Postby Sizik » Sat Dec 03, 2011 9:43 pm UTC

darkspork wrote:LOCK variable - Prevents other people from changing the value of the specified variable
UNLOCK variable - Take a guess what this does.

Any thoughts? It feels like it'dn't add any particular merit, and there'd need to be SOME kind of expiration policy in place, lest the entire namespace be constantized and the bubbly, unpredictable nature boil away.


When a variable is LOCKed, it starts decrementing (or incrementing if it's negative) at a rate of 1 per second, and UNLOCKs when it passes 0.
gmalivuk wrote:
King Author wrote:If space (rather, distance) is an illusion, it'd be possible for one meta-me to experience both body's sensory inputs.
Yes. And if wishes were horses, wishing wells would fill up very quickly with drowned horses.
User avatar
Sizik
 
Posts: 774
Joined: Wed Aug 27, 2008 3:48 am UTC

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Mon Dec 05, 2011 3:59 am UTC

I love all these ridiculous responses to the LOCK command. It's making it quite apparent that the feature's a little too advanced for the project deadline in two weeks.

Speaking of which, I finally got function definition and floating point variables (which seem to be taking nearly two seconds to parse for some reason!) working, but multi-dedents are still broken. Here's Bottles of Beer:

Code: Select all
HOW TO SING N
  BEERBOTTLES IS NOW N
  WHILE BEERBOTTLES IS BIGGER THAN ZERO
    BARK BEERBOTTLES, `` BOTTLES OF BEER ON THE WALL, '', BEERBOTTLES, `` BOTTLES OF BEER!''
    BARK ``TAKE ONE DOWN, PASS IT AROUND...''
    BEERBOTTLES IS NOW DIFFERENCE BEERBOTTLES, ONE
    BARK BEERBOTTLES, `` BOTTLES OF BEER ON THE WALL''


For some reason, this doesn't work, as something (either the server or the client) is cutting off the function at 253 characters (which is REALLY SUSPICIOUSLY close to 255, when you add the two bytes it takes to store what parameters the function has). It's almost definitely the server's database...
I'm at the stage of the project where ugly hacks start to appear...

Protocol for sending/recieving functions:
X REFERENCES SPACE LENGTH_OF_SOURCE_IN_BYTES SPACE INDENTED_SOURCE_CODE
and the equivalent packet that function above generates:
Code: Select all
1 2910 SET X N 298  BEERBOTTLES IS NOW N
 WHILE BEERBOTTLES IS BIGGER THAN ZERO
  BARK BEERBOTTLES, `` BOTTLES OF BEER ON THE WALL, '', BEERBOTTLES, `` BOTTLES OF BEER!''
  BARK ``TAKE ONE DOWN, PASS IT AROUND...''
  BEERBOTTLES IS NOW DIFFERENCE BEERBOTTLES, ONE
  BARK BEERBOTTLES, `` BOTTLES OF BEER ON THE WALL''
DONE

(The code tags seem to be messing this up. The WHILE line should be indented one space...)

and here's another one:
Code: Select all
 1 12938 SET REPEAT X SN 123  COUNTER IS NOW N
 WHILE COUNTER IS BIGGER THAN ZERO
  COUNTER IS NOW DIFFERENCE COUNTER, ONE
  BARK S
DONE


Another teacher of mine joked that, upon completing this project, I should write a GLOBOL interpreter in GLOBOL.

No.

EDIT: Heh. Just solved the database problem by storing values as BLOBs. The limit on the size of the value of a variable is now 1MB, but I'm not putting that explicitly in the language spec. Another thing I'm not explicitly putting in the language spec: the server randomly dropping values from its database for no reason whatsoever... or just dropping the database altogether. There's no difference to the client between the server doing that and some rogue program out there randomly setting variables to NULL.

EDIT: Finally fixed the dedent bug. I had to throw together a little hack to disable javacc's "infinite loop detector".
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Wed Dec 07, 2011 6:26 pm UTC

The interpreter is finished!

A download of the first... what can only be called a rough draft is available here.
To use it,
Code: Select all
java -jar globol.jar

and you get the interpreter. cat a file into it to run the file for now. I somehow managed to forget all this high level stuff like "loading a file from the command line" in the original spec. :/

Still trying to figure out how to get the config file out of the jar so the server's IP isn't hard coded into the program.
Client/server source code coming soon.

And a complete list of GLOBOL reserved words so far:

Code: Select all
ALL
AND
ANSWER
BARK
BIGGER
BILLION
BLANK
BOTH
BY
CLEAR
COURSE
DIFFERENCE
EIGHT
EIGHTEEN
EIGHTY
EITHER
ELEVEN
ERGO
FIFTEEN
FIFTY
FIVE
FOO
FORTY
FOUR
FOURTEEN
GOTO
HOW
HUNDRED
IF
IS
LIKE
MAYBE
MILLION
NINE
NINETEEN
NINETY
NO
NOPE
NOT
NOTHIN
NOW
OF
ONE
OR
OTHERWISE
POINT
PRODUCT
QUOTIENT
REMAINDER
RESULT
SEVEN
SEVENTEEN
SEVENTY
SIX
SIXTEEN
SIXTY
SQUEAK
SQUEAL
SUM
TEN
THIRTEEN
THIRTY
THOUSAND
THREE
TRILLION
TWELVE
TWENTY
TWO
WHILE
WITH
YES
YUP
ZERO
ZILCH


The list is subject to change for absolutely no good reason whatsoever
By the way, would you believe that of all the things I tried to add to this language, comments reigned supreme as the most damn difficult thing to add?

I plan to add some rudimentary exception handling abilities soon, and perhaps some form of the LOCK command... I'm thinking some form of "HOLD <variable> FOR <number> SECOND(s)" which might well fit in with the concept of PLEASE... Your use or lack of use of PLEASE won't cause the program to not compile randomly, as I originally came up with, but instead might be a bit more lenient on how much time it will give you?

Posting source code tonight when it's better documented. I'll leave that version up for a while to pollute the namespace before adding in these other cool features... also I have like two other projects I still need to do...
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby Mazer1010 » Sun Dec 11, 2011 5:11 pm UTC

I made an account specifically to say that I just solved the first Project Euler problem using GLOBOL and it felt way more satisfying than when I did it with java and python. I'm usually too ashamed to post my code on their forums but I might just have to post my GLOBOL code for it:

Code: Select all
HOW TO PROJECTEULER N
  IF N IS ONE
    MYINDEX IS NOW NINE NINE NINE
    MYSUM IS NOW ZERO
    WHILE MYINDEX IS BIGGER THAN ONE
      IF ZERO IS REMAINDER MYINDEX AND THREE
        MYSUM IS NOW SUM MYSUM AND MYINDEX
      IF ZERO IS REMAINDER MYINDEX AND FIVE
        MYSUM IS NOW SUM MYSUM AND MYINDEX
      IF ZERO IS REMAINDER MYINDEX AND FIFTEEN
        MYSUM IS NOW DIFFERENCE MYSUM AND MYINDEX
      MYINDEX IS NOW DIFFERENCE MYINDEX AND ONE
    ANSWER IS NOW MYSUM
  OTHERWISE
    ANSWER IS NOW TWO


This took me about twenty minutes to figure out (especially since add and subtract became sum and difference without my noticing at first, but that's ok) and the code took about 60 seconds to run.

Also, while I was messing around learning the syntax, I was defining some made-up functions and then I got a syntax error and I was upset that I would have to re-type my functions again in the restarted interpreter, but then I realized ... it's GLOBOL where those functions will still be there! It made me happy. Very fun!
Mazer1010
 
Posts: 6
Joined: Sat Dec 10, 2011 10:41 pm UTC

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Mon Dec 12, 2011 8:24 am UTC

Mazer1010 wrote:I made an account specifically to say that I just solved the first Project Euler problem using GLOBOL and it felt way more satisfying than when I did it with java and python.


Awesome, and welcome to the fora! :D

Mazer1010 wrote:Also, while I was messing around learning the syntax, I was defining some made-up functions and then I got a syntax error and I was upset that I would have to re-type my functions again in the restarted interpreter, but then I realized ... it's GLOBOL where those functions will still be there! It made me happy. Very fun!

I went through the same realization. In theory, all changes should be pushed before program termination. I have some class time tomorrow to polish up the code, so I'll probably be able to handle out-of-memory and stack overflow errors with a bit more grace. It'd be nice if Java could detect if STDIN is a terminal and... not terminate immediately on errors if so.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby phlip » Wed Dec 14, 2011 8:32 am UTC

darkspork wrote:It'd be nice if Java could detect if STDIN is a terminal and... not terminate immediately on errors if so.

Well, the second part is simple enough, but yeah, I don't see any way to detect if System.in is a terminal... Maybe you can hook into isatty with JNA? I mean, you'd lose some amount of platform independence, but you can always fall back to the current behaviour if it's an unrecognised platform...
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7144
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: GLOBOL: An esoteric language for the whole world

Postby Kick » Wed Dec 14, 2011 8:56 am UTC

I just want to say that even though I just started learning programming, I found this very entertaining and may attempt to work with it when I have the time. Good work, I love the comments/bark-ing.
I'm never sarcastic.
User avatar
Kick
 
Posts: 112
Joined: Thu Nov 17, 2011 6:24 am UTC
Location: Pennsylvania

Re: GLOBOL: An esoteric language for the whole world

Postby Dropzone » Wed Dec 14, 2011 6:59 pm UTC

phlip wrote:
darkspork wrote:It'd be nice if Java could detect if STDIN is a terminal and... not terminate immediately on errors if so.

Well, the second part is simple enough, but yeah, I don't see any way to detect if System.in is a terminal... Maybe you can hook into isatty with JNA? I mean, you'd lose some amount of platform independence, but you can always fall back to the current behaviour if it's an unrecognised platform...

The best you can do with the standard library is probably System.console() != null - it seems to return true exactly when both System.in and System.out are a terminal, which is probably close enough for this use case.
User avatar
Dropzone
 
Posts: 405
Joined: Sun Dec 30, 2007 10:12 pm UTC
Location: North Lincs., UK

Re: GLOBOL: An esoteric language for the whole world

Postby Yakk » Wed Dec 14, 2011 7:13 pm UTC

You could just do an "interactive" command.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10370
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Tue Dec 20, 2011 7:32 pm UTC

Dropzone wrote:The best you can do with the standard library is probably System.console() != null...


This works like a charm! I'm looking into Java equivalents of the Python/Ruby optparse library now, as well to add a few different command line flags. I'm planning on a restriction that files executed from the command line must be in ALL UPPERCASE and contain no more than eight characters in their main body and end with .GBL

Kick wrote:I just want to say that even though I just started learning programming, I found this very entertaining and may attempt to work with it when I have the time. Good work, I love the comments/bark-ing.

Thanks! If anything, I hope its intentional shortcomings give a deeper appreciation for some concepts in C/C++/Java that confused me at first. :roll:

My server has an annoying habit of doing this:
Code: Select all
ActiveRecord::StatementInvalid: Mysql::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/' (13): SELECT  `variables`.* FROM `variables`  WHERE `variables`.`name` = 'COUNTER' LIMIT 1

It cycles through eight threads to handle its processing, and that seems to happen whenever a thread remains inactive for an extended period of time. If you've been getting the error message
THE INTERNET IS BEING MEAN
EPIC FAIL
this is why. I suspect it's a messed up config somewhere, but the Googles have been disappointingly vague on this.

I'm handing this project in tomorrow, probably with a few new features including exception handling:
  • Code: Select all
    WHEN SOMETHING GOES WRONG, [expression, assignment, or TRY AGAIN]
      [error prone code]

  • New function: OINK (is to SQUEAL as BARK is to SQUEAK)
  • When any error is thrown, it will be stored in ERROR (which is now a reserved word). Thus, you can say:
    Code: Select all
    WHEN SOMETHING GOES WRONG, SQUEAL THE ERROR
      BARK THE QUOTIENT OF ZERO AND ZERO

  • DO and FIND are now ignored like THE and OF

I've also loosened the restriction on all uppercase in string literals and comments, though variable names and all reserved words are still in ALL UPPER CASE. After that, I'll release the source and a less complicated README that better explains the language than this fragmented thread.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby sourmìlk » Wed Dec 21, 2011 5:47 am UTC

What are the differences between BARK, OINK, SQUEAL, and SQUEEK
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
User avatar
sourmìlk
If I can't complain, can I at least express my fear?
 
Posts: 6407
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong

Re: GLOBOL: An esoteric language for the whole world

Postby darkspork » Wed Dec 21, 2011 6:32 am UTC

sourmìlk wrote:What are the differences between BARK, OINK, SQUEAL, and SQUEEK

All programs have three "streams" they can use - STDIN, STDOUT, and STDERR. If you're a Java person, you'll perhaps recognize them as System.in, System.out, and System.err respectively. There's a decent Wikipedia article on it.

BARK and SQUEAK send their output to STDOUT, while OINK and SQUEAL send their output to STDERR.

In addition, many programs have two different print methods. Java has print() and println(). Ruby has print and puts. The difference is:

BARK and OINK will add a newline to the end of the text string before printing it if it doesn't have one already.
SQUEAK and SQUEAL will not.

Thus,
Code: Select all
BARK ONE
BARK TWO
SQUEAK THREE
SQUEAK FOUR
SQUEAK FIVE
BARK SIX

prints:
Code: Select all
1
2
3456
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY
User avatar
darkspork
 
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: GLOBOL: An esoteric language for the whole world

Postby Kithplana » Thu Jan 05, 2012 4:24 am UTC

darkspork wrote:My server has an annoying habit of doing this:
Code: Select all
ActiveRecord::StatementInvalid: Mysql::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/' (13): SELECT  `variables`.* FROM `variables`  WHERE `variables`.`name` = 'COUNTER' LIMIT 1

You might try adding
Code: Select all
reconnect: true
to your database.yml, observing these caveats. Failing that, it could be exhausting or leaking MySQL connections.
User avatar
Kithplana
 
Posts: 400
Joined: Mon May 14, 2007 11:12 pm UTC

Next

Return to Coding

Who is online

Users browsing this forum: headprogrammingczar and 5 guests