• Fake Programming Language
    330 replies, posted
I've been wanting to make an esoteric language for a while, just haven't got around to making a compiler. [code]start |-comment-| |-Multi Line Comment-| write 'Hello_World' write '---' write 'H' & 'E' & 'L' & 'L' & 'O' & '_' & 'W' & 'O' & 'R' & 'L' & 'D' write '---' sto 'A' - 'hello' sto 'B' - 'world' sto 'C' - 'Hello' & 'World' write A write '---' write B write '---' write A & B write '---' write C stop[/code] And output would be: [code]Hello World --- H E L L O W O R L D --- hello --- world --- Hello World[/code] I went for something similar to TI-BASIC when I originally made this, because TI-BASIC is so fucking cool
[code]anuspenisanusanusanusanuspenisanusanuspenispenisanusanuspenisanuspenisanusanuspenisanusanusanusanusanusanuspenispenispenisanusanuspenispenisanuspenispenispenisanuspenisanuspenisanuspenispenispenisanusanuspenisanusanuspenispenisanusanuspenis anuspenisanusanuspenisanusanusanusanusanusanuspenispenispenisanuspenisanusanusanuspenispenisanuspenispenispenispenisanusanuspenisanusanusanusanusanusanuspenispenisanusanuspenisanusanusanuspenispenispenisanusanuspenisanusanuspenispenisanus penisanusanuspenisanuspenispenisanuspenispenispenisanusanuspenispenisanuspenisanuspenispenisanusanuspenisanusanusanusanusanusanuspenispenispenispenisanusanuspenisanuspenispenisanuspenispenispenispenisanuspenispenispenisanuspenisanuspenisanuspenis penispenisanusanuspenisanusanusanuspenisanusanusanusanusanusanuspenisanusanuspenispenispenispenisanuspenispenispenisanuspenispenisanusanuspenispenisanusanusanusanuspenisanuspenispenisanuspenispenisanusanusanuspenispenispenisanuspenisanusanus anuspenispenisanuspenisanusanuspenisanuspenispenisanuspenispenispenisanusanuspenispenisanusanuspenisanuspenisanusanuspenisanuspenispenispenisanus[/code] Fuck yeah
[code] mode procedural; begin { "Hello, world\n"-; } end { "Goodbye, world\n"-; } [/code] Bascically, in each scope (the largest scope being the file itself), you can have begin/end blocks. The begins will be executed first no matter where they are, and naturally the ends will be executed last. The - operator is used for I/O; the default filehandles are stdout for output and stdin for input. For example, to receive input into the variable [i]input[/i]: [code] -input;[/code] There's no need to specify the filehandle since stdin is the default. If you wanted to read data from another opened filehandle into input: [code] {fhname}-input; [/code] The curly braces are to distinguish filehandles from variables and such. Then, this simple program would read from stdin and print to stdout continuously: [code]-;[/code] These are some of my vague ideas for my language. I'm looking into lexers and CC's so i can construct the grammar for it. EDIT: oh yeah, and that "mode procedural;" at the top specifies that this program will be purely procedural, no OO and stuff. I can't really describe it much more cause that's one of my vaguest ideas right now.
[QUOTE=VoiDeD;16850513]Did you miss the "\"?[/QUOTE] It is still a single line in the end though.
attach "InOutCommands"; attach "Math"; function start() { int int; write:"Input how many primes you want to find :" . newline; input:int; -- Do some code here -- -- end some code here -- } Just some basic code lol.
[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] If you somehow could merge that with a C++ compiler, I would actually see a use for brainfuck.
[code] there be some islands: dragonisland with many dragons and \a danger being great, hideout with 5 wenches. there be some ships: bounty. there be some sailors: seadog telling a story, pickles, hagen being the captain. seadog: "do you fear dragons?" he asked lubber. lubber can answer with arr or ney. did lubber answer arr? "the island we are sailing to is adventureful! it has " tell loot from dragonisland "!", "what do ye think how many dragons there be?" here be dragons, "so you think it has "tell dragons from dragonisland" dragons!", bounty be sail, his story be a island \with tell loot from dragonisland. or did lubber answer ney? "then i can't tell you anything interesting.", his story be a boring one. pickles: here be no a danger on dragonisland and \no dragons. tell "seadogs story is a lie! also, the island we are sailing to has no dragons!". hagen: "captain: matey! do you want to hear seadogs tale?" he asked lubber. lubber can answer with arr. "captain: seadog, tell your tale!". until avast "seadog: " story of seadog. did bounty sail? "pickles shouts: "pickles, "captain: so there be "tell loot from dragonisland. "captain: well me heartys, lets get back to the hideout, there be "tell loot from hideout"!". [/code] Tried to make something awesome but ended up raping my own mind.
n00b question: Is it really hard to make an esoteric programming language? Or something like that
It's not hard, you just basically make a virtual computer and assign the commands in your language to functions and such. I always get stuck at looping though.
function sex(); call getlaid; end;
[QUOTE]make a virtual computer[/QUOTE] wat [QUOTE]It's not hard[/QUOTE] Oh cool. Any good basic (That's with lowercase latters) examples with source code?
[code] hello world [/code]
A virtual computer isn't really hard to make. Imagine what you really need for a really simple computer. You'd need memory, a processor, a way to input stuff and a way to output stuff. Let's break those down into how you'd program those in a VM. Memory: Easy, just make an array/vector/list that can expand to be as big as any program would need it to be. CPU: This will be basically the main function of the program that reads the string that is the "Assembly" for your cpu and performs them. Basically you just read each part of the string to see what it is. If it's a keyword for your language, the syntax of your language will predict what comes after it. So say to add two numbers your code is "Add x y". Everytime you see Add, you know that x and y should follow and what type they should be. If you get something you don't expect, it's a syntax error. If everything is as it should be, you just perform the add function on x and y and go to the next line of code. I/O: This should also be easy since whatever language you use will already have that done for you. So say your language version of the input command is just "Input x" you just have your "cpu" call the input function for whatever language you are making the VM with. The same with output. As for an example, this place has a brainfuck interpreter written in various languages: [url]http://rosettacode.org/wiki/RCBF[/url]
Have you guys heard of COMPUTE, I read about it on wikipedia. It can compute ANYTHING though it has i/o stream. Here is some example code: [code] Compute meaning of love Compute the meaning of live [/code] A team of elite hakzors ( or not ) managed to add simple output: [code] Calculate meaning of love Working.. Done! [/code] I also created a language called Fucking Annoying, based after its weird syntax. [code] {This is a comment} {Bools are tRUE and FALse} create function foo[a, b] /* c = a+b *\ {Variables are defined as so} regetni a = 34566 loob b = tRUE while[tRUE] /* call foo[2 , 5] print[c] *\ [/code]
hey pc! print "hello world". thanks.
[code]_Init.It Load.it("Mah THINgY ScRiPt", 100110, 82571124115):; Cache.It(last(Load.It):; Init.It("For") LOL:ME(FOR, Unit/Init, Shady, Cake, Pie) For("X, Y, Z, In.Pixels :: Shape(Text("Hello World")), Do.It.Funtion.It( Pixels.Set.Color = Get.Color.Text :/: Get.Center.Distance Pixel.Print.Colored(Pixel.Get.Color, X, Y, Z, Clear) End.It Clear.Cache.It(all) Clear.Load.It(all) _End.It[/code]
"Hello, World!"
[QUOTE][CODE] hello world[/CODE][/QUOTE] Make a compiler for that. Then write an OS using that.
[code]Start Code: /Onscrn/: Hello World /TerminatePrcs/: Onscrn /Close/ [/code] Lol.
[QUOTE=09'er;16920654][code]Start Code: /Onscrn/: Hello World /TerminatePrcs/: Onscrn /Close/ [/code] Lol.[/QUOTE] That is so illogically named its stupid. /TerminatePrcs/ is stupid. Because /Onscrn/ isn't a process its a function for putting things on screen. They might be made up but come on. Do you even program?
[code] main() print "Hello world"; z; input z; print z; x = 5; y = 6; drawline (x, y); drawsquare (5); endmain; [/code]
How would you draw a line using co-ordinates in a console?
Meaby with Curses or Conio
[code]fucking print "hello world"; {stop printin that shit] [end this god damn code mother fucker !DID I TELL YOU TO END? Well of COURSE I DID, SO DO IT.[/code] The hardest part is remembering where "mother fucker" goes.
[code] func HiHi() SET TIME US = 18:20, EU = 2:01, AS = 23:85;; GET TIME;; SET garry = "AWESOME";; SET gmod = "Buggy!!!";; PRINTLINE => "Garry is "..GET:garry;.." but GMod is "..GET:gmod;.."";; SET FUNC => end;; end CONCOM:ADD => "rp_openthis";HiHi;once;; [/code] Well, this one looks like shit, but this is my fantasy! :D
[code]{strt:console } write.#Output; 'Hello World' on.Write; {face:type.See; center-align;48px;facecolor:green; } display.#Output=face:type.See, end:console}[/code] IDK what ANY of that means, it just looks scary.
[Console: ...Booting ...Plugging into brain ...Brain memory 13,371,337 Terra Bytes ...IDE has started ...Mind is being read ...Begin programming when ready ...Let there be light - Light Created ...I can see - Camera Created ...20,000 Physics cubes created ...Life added to first cube ...First cube is scared ...First cube combines with 19,999 cubes ... ...Cube has become Borg and will attempt to assimilate you ...You have been assimilated ...Goodbye ... ... ...Error ...Brain memory dump ]
Simplified, commentless code: [CODE] {$main (print("LOLWHUT\n")) } [/CODE]
Right heres one called Robbery. [code] Safehouse: //Data allocation really bag a = cash // variable "a" for integers bag b = gold bar // variable "b" for floats bag c = crate // variable "c" for double bag string = item //variable "string" for strings bag array of bags //array called "array" Robbery: // Main Program Everybody load up //Init This is a hold up //Start of Program Steal "Hello, World" into string //Setting bag string as "Hello, World" Show bag string // Prints it to screen You never saw me //End of Program [/code] Still needs some polishing.
Nice idea, except this line is completely unnecessary in my opinion: [code] Everybody load up //Init [/code]
Sorry, you need to Log In to post a reply to this thread.