• Fake Programming Language
    330 replies, posted
[QUOTE=Shanethe13;17635092][code] --riverrun, past Eve and Adam’s, from swerve of shore to bend of bay, brings us by a commodius vicus of recirculation back to Howth Castle and Environs. Stately, plump Buck Mulligan came from the stairhead, bearing a bowl named OUTPUT on which a "Hello World" lay crossed. He held the bowl aloft and intoned: OUTPUT A way a lone a last a loved a long the-- [/code][/QUOTE] Take a look at Shakespeare.
[QUOTE=DrTaxi;17658872]Take a look at Shakespeare.[/QUOTE] I've seen it. When I entered the thread, my first idea was to make a language based on Shakespeare quotes, but a quick search showed me it already exists. James Joyce seemed like the next best thing.
[code]y=x^2 O { x=8.48 x=10.24 } [/code] Outputs [code] Hi [/code] You'll get it... sooner or later. I'm going to actually see if I can write a parser.
[QUOTE=Deadollie;17617233][code] OHHAITHAR; say ""Hello, World!""; KTHANXBAI; [/code][/QUOTE] I would use that language. [editline]05:06PM[/editline] [QUOTE=Mister Royzo;17658766][code] like get all the stuff that is, like, needed? when like the user guy presses the big button do stuff below say like hello to the world do stuff above like stop [/code] Cheerleader-proof language. Oh the software that would come from it.[/QUOTE] Yeah MSN rippoff's and an MSN Interface that is pink and can not be changed.
*Looks at random dude* [code]Dude, could you say hello world to me?[/code] This code doesn't always work if this doesn't use this: [code]I've got a gun in my pocket. Say hello world or I'll shoot you[/code] If that doesn't work say: [code]Free candy if you say hello work[/code] Code might be different on each "system"
[php] /* CPPHPython v0.02 A nonexisting, awesome language This is a multiline comment */ //C++/Python hybrid of loading headers/modules load io; //Load io module, not needed but provides functions like io.print("Hello World\n"); // Print Hello World and a newline // PHP-style variables $number = 1; //Create a variable called number and assign the value 0 to it $input = 0; //Create a variable called input and assign the value 1 to it io.print("Enter a number: ") //No annoying << and >> like in C++, just plain and simple io.read($input); //Read input and save it to a variable if($input == $number) io.print("Your input equals " . $number . "!\n"); // Python style indenting! else io.print("Your input did not equal " . $number . "!\n"; return 0; [/php] Pretty proud of it myself. Edit: Fixed some mistakes, load is a statement and thus needs a semicolon. Also changed the BBCode so I could get syntax highlighting Edit2: Updated again.
[QUOTE=Denzo;17694084][code] /* CPPHPython v0.1 A nonexisting, awesome language This is a multiline comment */ //C++/Python hybrid of loading headers/modules load std //Load standard module, always needed load io //Load io module, not needed but provides functions like io.print("Hello World\n"); // Print Hello World and a newline // PHP-style variables $number = 1; //Create a variable called number and assign the value 0 to it $input = 0; //Create a variable called input and assign the value 1 to it io.print("Enter a number: ") //No annoying << and >> like in C++, just plain and simple io.read($input); //Read input and save it to a variable if($input == $number) io.print("Your input equals " . $number . "!\n"); // Python style indenting! else io.print("Your input did not equal " . $number . "!\n"; return 0; [/code] Pretty proud of it myself.[/QUOTE] Make a compiler for that. Now.
[QUOTE=Eudoxia;17694141]Make a compiler for that. Now.[/QUOTE] If I only knew how to :sigh:
[QUOTE=iPope;17600669]Hi, welcome to the Programming Section.[/QUOTE] Wrong. It's "HELLO YOU PIECE OF FAGGOTSHIT AND WELCOME TO THE MOTHERFUCKING PROGRAMMING SECTION MAY I TAKE YOUR GODDAMN COAT RAAAAAAAAAGH FUCK MAN THESE STEROIDS ARE THE SHTI FUKC YEAHHHHHHHHHHHH"
If you always need to load std... why doesn't/wouldn't it just automatically do it?
[QUOTE=Denzo;17694166]If I only knew how to :sigh:[/QUOTE] Same prob here :sigh: :saddowns: [QUOTE]If you always need to load std... why doesn't/wouldn't it just automatically do it?[/QUOTE] BECAUSE THE COMPILER IS SHTOOPID
[QUOTE=ZeekyHBomb;17694233]If you always need to load std... why doesn't/wouldn't it just automatically do it?[/QUOTE] Hmm, good idea. Fixed
[CPP] {$gvar /*Global variables*/ (string: (name1, name2, location)) } {$main (iof("Hello! This is the formatted I/O stream! Your name: %name")) (io(Hello again! This is the unformatted I/O! Name again: (name2))) /*Formatted IO is for people who use C/C++. Unformatted is faster, but you can screw up everything if you forge the parentheses*/ (strcmp(name1:name2)== 0) if(return == 0) do { o(So you are not a liar, (name2).\n)) } elif(return != 0) do { o(LIAR\n) (terminate) } } [/CPP] unformatted: (some_io_function(hello, (name))) formatted: (some_io_functionf("Hello, %name"))) EDIT: How do I add the syntax highlighting?
[quote]EDIT: How do I add the syntax highlighting?[/QUOTE] [noparse][cpp][/cpp][/noparse] but that only does C++ keywords and such
[QUOTE=jivemasta;16840329]I always wanted to take brainfuck and make it a little less of a brain fuck, and more useful like this: > and < move the memory index pointer 0-9 add integers to the memory at the current index a-Z add chars to the memory at the current index +,-,*-/ does the operation to the current index and the next index to the right @(#) copies the current index to index of #( like @(3) copies to the third memory index) . prints the current index , takes input {} loops, if current index = 0, break loop [] if current index = 0 skip stuff inside So hello world would be: H>e>l>o>W>r>d<<<<<<.>.>..>.>.<.>>.<<<.>>>>. Fibonacci loop (1,1,2,3,5,8,13...) would be: 1>1>0<<{.>.<@(3)+@(3)>+<}[/QUOTE] Creating an Interpreter for this language, it's around half-done at the moment [url]http://www.filepak.com/upload/4_LBf.rar[/url] Anyways, I'll just make a thread when I get it working alright
Cool. Can you post the sources? EDIT: Never mind. I opened the .rar in a folder full of other stuff, I didn't notice the lbf.c file.
how about this [code] start // start! ComputeOn=GPU; // (Computes on the specified processor,e.g. CPU/GPU,MCPU4 (multithreaded,4 threads) or CPUGPU for both) ComputeType=CUDAorStream; //Usually put only when using the GPU to compute exec "say"; // execute, say outputs text windowsize=300x100; // window size! text"hello world"@100x100; // say-text command outputs text on the window,<text in ""s after>,where font=arial,53; // For the whole window; font,size. button1@5x5"cool"; // button,button number,where,text"; stop //end! [/code]
This is based off PHP and C++. Note that I wrote this as if it were a real programming language. [code]lib:load("stdio"); //includes the Standard IO library lib:load("prsettings"); //includes the program settings library lib:load("filesystem"); //includes the file reading/writing library const:load("prsettings"); //Loads a set of premade constants const:load("lib"); //Ditto const:load("stdio"); //Ditto const:load("filesystem"); //Ditto class:Create(stdio); //Creates a blank class class:Create(prs); //Ditto class:Create(fsys); //Ditto lib:get("stdio",stdio); //Puts the library classes into the stdio class lib:get("prsettings",prs); //Ditto lib:get("filesystem",fsys); //Ditto //Note: For simplicity's sake, the ':' character is used for functions and the '.' is used for variables ## //Preprocessor directive start. Note that the preprocessor loads some info about libraries that have been included above this. pproc<load class.prs>; //A preprocessor command. This loads the class prs into the preprocessor so it can access some of the functions. prs:SetProgramType( PRS_CONSOLE ); //Makes the program command line ## //Ends the preprocessor directive //Note that a single # is a one line directive, while ## is multiline. /* Multi- line comments!!! */ class world //a class { function hello( test ) { stdio:Print(test . NLINE); //Prints the variable 'test' to the console, then a newline character. stdio:Print("Hello World!\n"); //Same as cout in C++ (prints text on the command line, though it can also be used to print text in a textbox in windows mode) var text text = stdio:GetText(STDIO_WAIT_FOR_NEWLINE); //Same as cin in C++ (retrieves text from the command line) and waits for a newline character to be typed. fsys:CreateWrite("hello_world.txt"):WriteData("Hello World! You typed " . text); //Creates a file, then writes a string cocatinated to the variable 'text' fsys:CloseLast(); //Closes the last file } }[/code] Yes I know this is overcomplicated, but it is fun creating overcomplicated languages XD
[code]Exe.RD.Start while blnGarry = 1 intSuccess = Rate.Dumb(pstCount=intNum) intNum ++ if intSuccess = 0 then intNum = 100 end if end while Abort children[/code] basically rates every post dumb until the Boolean Garry equals 0. Once he equals 0 it will abort children.
[CPP]//load(std,io,os) #Set console[0 0, 256 256] #move cursor[0, 0] #use console @echo("Hello, World!") @wait user_input @sound 10 >> 33 @delay 1000 @sound off @end console @end all[/CPP] // = Preprocessor # = System (Interact with console, screen, memory, firware, hardware, compiler) @ = Instructions
[QUOTE=Shadow187(FP);16838752]Program Hello_World; Begin str: Hello; Hello = 'Hello world!'; Print(Hello); End[/QUOTE] pascal? [code] PROGRAM IS HERE WRITE THIS: "SHUT UP STUPID" GO AWAY I MEAN END [/code]
[QUOTE=Kilgannon;17768876]pascal?[/QUOTE] I already said that :saddowns:
Guy I know did this one. It's fun to mess around with. [quote]I wrote an interpreter in C for this language. I've named the interpreter "buttfuck" since this is a fucked-up version of brainfuck. The interpreter is pretty minimal. I made no attempt to write "good" code, I used unsafe C functions like strcpy(), and I made no attempt to free memory (but it gets freed after the program exits anyway). The parser also doesn't really report errors correctly, unless you compile a debug version. Oh, and in some cases it'll break on really large programs/strings. But here it is anyway, all 413 lines of sexy interpreter code:[/quote] [code] /* * buttfuck.c - Interpreter for the Buttfuck programming language. * Compile: * $ gcc -o buttfuck buttfuck.c */ #include <ctype.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define TKN_BUF_SIZE 256 #define MAX_PATH 256 #define FIRST_LINE 1 #define FIRST_COL 1 typedef enum {ERR_BAD_ARGS = 1, ERR_OUT_OF_MEMORY, ERR_BAD_FILE} bf_memory_error; typedef enum {TKN_STRING = 0, TKN_LOCATION, TKN_EOF, TKN_ERROR} bf_token_type; typedef enum { S_START, S_DONE, S_EOF, S_STRING, S_LOCATION, S_TILDE, S_DATA, S_ERROR } bf_token_state; const char *TOKEN_NAMES[] = {"STRING", "LOCATION", "EOF", "ERROR"}; #define PLUS_MASK 0xffffffff #define MINUS_MASK 0x0 typedef struct { bf_token_type type; unsigned int line; unsigned int col; char *val; } bf_token; typedef struct { const char *path; FILE *stream; unsigned int line; unsigned int col; } bf_tokenizer; typedef struct { bf_tokenizer *stream; char *path; char *str; } bf_parser; static char *expand_tildes(char *origpath, char *newpath) { char *home = NULL; char *xpath = NULL; home = getenv("HOME"); xpath = strchr(origpath, '~'); xpath++; sprintf(newpath, "%s%s", home, xpath); return newpath; } static bf_token *bf_create_token(bf_token_type type, unsigned int line, unsigned int col) { bf_token *tkn = NULL; tkn = (bf_token *) malloc(sizeof(bf_token)); if (!tkn) { perror("bf_create_token"); exit(ERR_OUT_OF_MEMORY); } tkn->type = type; tkn->line = FIRST_LINE; tkn->col = FIRST_COL; tkn->val = NULL; return tkn; } static void bf_free_token(bf_token *t) { free(t->val); free(t); } static char *bf_token_format(bf_token *t) { char *s; s = (char *) malloc(64); if (!s) { perror("bf_token_format"); exit(ERR_OUT_OF_MEMORY); } s = strcpy(s, TOKEN_NAMES[t->type]); if (t->val) { sprintf(s, "%s(%s)", s, t->val); } sprintf(s, "%s [%u]", s, t->line); return s; } static bf_tokenizer *bf_create_tokenizer(const char *path) { bf_tokenizer *t = NULL; FILE *fh = NULL; t = (bf_tokenizer *) malloc(sizeof(bf_tokenizer)); if (!t) { perror("bf_create_tokenizer"); exit(ERR_OUT_OF_MEMORY); } t->path = path; fh = fopen(path, "r"); if (!fh) { perror("bf_create_tokenizer"); exit(ERR_BAD_FILE); } t->stream = fh; t->line = 0; t->col = 0; return t; } static void bf_free_tokenizer(bf_tokenizer *t) { fclose(t->stream); t->stream = NULL; free(t); } static unsigned char bf_getc(bf_tokenizer *t) { int c; c = getc(t->stream); t->col++; switch (c) { case '\t': c = ' '; t->col += 7; break; case '\n': c = ' '; t->line++; break; case EOF: c = '\0'; break; } return (unsigned char) c; } static unsigned char bf_ungetc(bf_tokenizer *t, unsigned char ch) { int c; c = ungetc(ch, t->stream); return c != EOF ? (unsigned char) c : '\0'; } static bf_token *bf_next_token(bf_tokenizer *t) { bf_token_type type; bf_token *tkn = NULL; bf_token_state state = S_START; char *buf = NULL; unsigned int bufpos = 0; unsigned int bitpos = 0; unsigned int masked = 0; unsigned int bitmask = 0; buf = (char *) malloc(TKN_BUF_SIZE); if (!buf) { perror("bf_next_token"); exit(ERR_OUT_OF_MEMORY); } while (state != S_DONE) { unsigned char ch = bf_getc(t); switch (state) { case S_START: switch (ch) { case '\0': state = S_DONE; tkn = bf_create_token(TKN_EOF, t->line, t->col); break; case '.': state = S_START; break; case '[': state = S_STRING; break; case '~': state = S_TILDE; break; default: #ifdef DEBUG fprintf(stderr, "Error (START), expected EOF, '.', '[', or '~', got %c\n", ch); #endif state = S_ERROR; buf[bufpos++] = ch; break; } break; case S_DATA: switch (ch) { case '[': state = S_DATA; break; case '>': bitpos++; if (bitpos > 7) { unsigned char bc = (unsigned char) masked; if (!isprint(bc)) { fprintf(stderr, "Warning: non-printable character %#x, " "line %u, col %u\n", bc, t->line, t->col); } buf[bufpos++] = bc; bitpos = 0; masked = 0; } bitmask = (unsigned int) pow(2, (7 - bitpos)); break; case '+': state = S_DATA; masked |= (PLUS_MASK & bitmask); break; case '-': state = S_DATA; masked |= (MINUS_MASK & bitmask); break; case ']': state = S_DONE; buf[bufpos++] = (unsigned char) masked; tkn = bf_create_token(type, t->line, t->col); break; default: #ifdef DEBUG fprintf(stderr, "Error (%s), expected '[', '>', '+', '-', ']', got %c\n", (type == TKN_STRING ? "STRING" : "LOCATION"), ch); #endif state = S_ERROR; buf[bufpos++] = ch; break; } break; case S_TILDE: switch (ch) { case '[': state = S_LOCATION; break; default: #ifdef DEBUG fprintf(stderr, "Error, expected '~', got %c\n", ch); #endif state = S_ERROR; buf[bufpos++] = ch; break; } break; case S_STRING: state = S_DATA; type = TKN_STRING; break; case S_LOCATION: state = S_DATA; type = TKN_LOCATION; break; case S_ERROR: if (ch == '\0') { state = S_DONE; tkn = bf_create_token(TKN_ERROR, t->line, t->col); } else { buf[bufpos++] = ch; } break; } } buf[bufpos] = '\0'; /* Terminate that string, son! */ tkn->val = buf; return tkn; } static bf_parser *bf_create_parser(bf_tokenizer *t) { bf_parser *p = NULL; p = (bf_parser *) malloc(sizeof(bf_parser)); if (!p) { perror("bf_create_parser"); exit(ERR_OUT_OF_MEMORY); } p->stream = t; p->path = NULL; p->str = NULL; return p; } static void bf_free_parser(bf_parser *p) { bf_free_tokenizer(p->stream); free(p->path); free(p->str); free(p); } static void bf_parse_string(bf_parser *p) { bf_token *t = NULL; t = bf_next_token(p->stream); switch (t->type) { case TKN_STRING: p->str = t->val; break; default: fprintf(stderr, "Error: Line %u, Col %u\n", t->line, t->col); break; } } static void bf_parse_location(bf_parser *p) { bf_token *t = NULL; t = bf_next_token(p->stream); switch (t->type) { case TKN_LOCATION: p->path = t->val; break; case TKN_EOF: break; default: fprintf(stderr, "Error: Line %u, Col %u\n", t->line, t->col); break; } } static int bf_parser_run(bf_parser *p) { FILE *fh = NULL; char path[MAX_PATH]; size_t len = 0; bf_parse_string(p); bf_parse_location(p); fprintf(stderr, "Path: %s\n", p->path); fprintf(stderr, "String: %s\n", p->str); expand_tildes(p->path, path); fh = fopen(path, "w"); if (!fh) { perror("bf_parser_run"); exit(ERR_BAD_FILE); } len = strlen(p->str); if (fwrite(p->str, len, 1, fh) < 1) { perror("bf_parser_run"); exit(ERR_BAD_FILE); } fclose(fh); return 0; } int main(int argc, char **argv) { bf_tokenizer *tokenizer = NULL; bf_parser *parser = NULL; if (argc < 2) { fprintf(stderr, "Usage: buttfuck source.bf\n"); exit(ERR_BAD_ARGS); } tokenizer = bf_create_tokenizer(argv[1]); parser = bf_create_parser(tokenizer); return bf_parser_run(parser); } [/code]
[code] //Version 2.0 //Updated Syntax. Default { GetInfo(Thread == ALL, "Facepunch\Oify") { RatePost(ALL, Dumb=="http://www.facepunch.com/fp/rating/box.png"); } } } [/code]
[QUOTE=wingless;17772706][code] Default { GetInfo(Thread == ALL, "Facepunch\Oify") { RatePost(ALL, Dumb "http://www.facepunch.com/fp/rating/box.png"); } } } [/code][/QUOTE] OH HAHAHAH AHHAHAHAHHA the 1000th rate all posts dumb joke AND ITS STILL AS FUNNY AS THE FIRST TIME!!!!!!11111 KEEP EM COMIN!!!!!!! PS RATE ALL POSTS DUMB LUL!!#@!$ WHAT!
[QUOTE=r4nk_;17772754]OH HAHAHAH AHHAHAHAHHA the 1000th rate all posts dumb joke AND ITS STILL AS FUNNY AS THE FIRST TIME!!!!!!11111 KEEP EM COMIN!!!!!!! PS RATE ALL POSTS DUMB LUL!!#@!$ WHAT![/QUOTE] I know, But mine is the first forum specific code. [editline]10:46PM[/editline] I Call it "Simplistic". It's for basic system for making Simple GFW/Xbox Live Support into Games And Multi Core Support :-) [code] Achievement_1(Simplicity=="Beat the Game on Easy Difficulty Mode", TRACK_COMPLETION_LEVEL==1); Achievement_2(Getting Better=="Beat the Game on Normal Difficulty Mode", TRACK_COMPLETION_LEVEL==2); Achievement_3(You're Good!=="Beat the Game on Hard Difficulty Mode", TRACK_COMPLETION_LEVEL==3); Enable==Core_Thread(2, 3, 3) //Multi Core Enabled up to 3 cores, Must specify at Core_Thread Opening Server_System==MICROSOFT_LIVE //Uses Xbox/GFW LIVE Online System Achievement_List[1,2,3] //Achievement list Achievement_Thread[DEFAULT] [Basic Code Here] Core_Thread { { System_Specific(AI_Thread, Core_Specific == 2/3 ELSE 2 ELSE DEFAULT, Priority == 5 || Intractable_Entities , Core_Specific == 3 ELSE DEFAULT, Priority == 3 || Weapon_System, Core_Specific == DEFAULT, Priority == 4); } } [/code] It makes adding multiple core support simple, Just set it your State's into the Core_Thread state and it will add priority to the system and what core if preferred. See the AI_Thread is shared between 2/3 if that can't be done it just moves all over to 2 if that fails default back to no 1 (DEFAULT)
[QUOTE=wingless;17772789]I know, But mine is the first forum specific code. [editline]10:46PM[/editline] I Call it "Simplistic". It's for basic system for making Simple GFW/Xbox Live Support into Games And Multi Core Support :-) [code] Achievement_1(Simplicity=="Beat the Game on Easy Difficulty Mode", TRACK_COMPLETION_LEVEL==1); Achievement_2(Getting Better=="Beat the Game on Normal Difficulty Mode", TRACK_COMPLETION_LEVEL==2); Achievement_3(You're Good!=="Beat the Game on Hard Difficulty Mode", TRACK_COMPLETION_LEVEL==3); Enable==Core_Thread(2, 3, 3) //Multi Core Enabled up to 3 cores, Must specify at Core_Thread Opening Server_System==MICROSOFT_LIVE //Uses Xbox/GFW LIVE Online System Achievement_List[1,2,3] //Achievement list Achievement_Thread[DEFAULT] [Basic Code Here] Core_Thread { { System_Specific(AI_Thread, Core_Specific == 2/3 ELSE 2 ELSE DEFAULT, Priority == 5 || Intractable_Entities , Core_Specific == 3 ELSE DEFAULT, Priority == 3 || Weapon_System, Core_Specific == DEFAULT, Priority == 4); } } [/code] It makes adding multiple core support simple, Just set it your State's into the Core_Thread state and it will add priority to the system and what core if preferred. See the AI_Thread is shared between 2/3 if that can't be done it just moves all over to 2 if that fails default back to no 1 (DEFAULT)[/QUOTE] Just because you've tried to make a complicated "this language makes a game easy" doesn't mean we accept it.
[QUOTE=iPope;17774620]Just because you've tried to make a complicated "this language makes a game easy" doesn't mean we accept it.[/QUOTE] It wasn't that, It's just because I was bored, Why I found fp in the first place XD
[code]hurfe { xd { RAET POST DUMB lole } lmao } durfe [/code]
get ready{ to print; get set{ to wait; go{ print("sup world") exit srsly EXIT!!!! Thats mine ;D
Sorry, you need to Log In to post a reply to this thread.