+ 25
>> Challenge: Create your own programming language in the playground! >>
First, decide on what code you want you use as an anchor. You could use Python, Java, C++, JavaScript, C#, PHP etc... The language doesn't matter. However, you must understand your anchoring language. You must also understand your goal. Secondly, take a piece of paper and write a rough draft of how your code looks like. Once you have done that, you can practice your anchor code. Finally, if you want to publish your language, create it as a single folder. Example: [name]---[anchor] ---[main]
10 odpowiedzi
+ 4
idk about the ->, that's an existing operator that i don't know how to (if it's possible) override to do what you want, but here
https://code.sololearn.com/cP3tTWdxxzbB/?ref=app
+ 15
That is really difficult task 😞
+ 15
Amazing @Lil!
+ 11
WOW! @LunarCoffee! That code is nice!
+ 7
I have an idea for a syntax if anyone wants one:
BASICS
---------
Every statement ends with a semicolon.
say(string message) is for outputting text. Does not include newline.
\n is newline.
listen() returns string from input
SETTINGS VARIABLES
----------------------------
Variables are statically typed, and caps sensitive.
int x = 5;
string hey = "Hello!";
const string ants = "are useful";
CONDITIONS - IF
---------------------
bool success = true;
on success -> {
say("Yo!");
}
CONDITIONS - ELSE
-------------------------
bool success = false;
on success -> {
say("True!");
} other {
say("False!");
}
CONDITIONS - ELSE IF
----------------------------
int number = 3;
on number == 3 -> {
say("Three!");
} otherwise number == 1 -> {
say("One!");
} other {
say("I don't know...");
}
LOOPS - WHILE
--------------------
int number = 3;
while number < 10 -> {
say(number);
}
you can add more on that, this is just the base.
+ 5
This is not a programming language created by myself but this is how I'd do to make it (I mean the C++ thing)
https://code.sololearn.com/WeGM0F21heJU/?ref=app
https://code.sololearn.com/c3D3fV73yfQU/?ref=app
https://code.sololearn.com/cIW5UWz6GZoq/?ref=app
+ 3
thanks :D
+ 3
I'll give this a go sometime, but watch this space for a very, very long time while I create it!
+ 2
UPDATE!!!!!!!
I HAVE A WAY!
I just have a question...
when a user writes ~include {example.ext} it will include example.ext
Now. it is an interpreted language and I'm using C as its output file.
I'm using batch to write everything out. Here's the problem:
How do I use the filename? I know this:
%~fI
...but I don't want to use the I variable in my language to include files. I also only want the filename.
Is there a solution?
Thanks!