Obratnaya
Obratnaya repl
Source
@SixBeeps @RaidTheWeb @NoNameByProgram Here is post!
Table for features
JavaScript | C# | Obratnaya | |
---|---|---|---|
No undefined | ❌ | ⭕️ | ⭕️ |
Null | ⭕️ | ⭕️ | ⭕️ |
Library | ⭕️ | ⭕️ | ⭕️ |
Function or Section | ⭕️ | ⭕️ | ⭕️ |
Class | ⭕️ | ⭕️ | ❌ |
Type | ❌ | ⭕️ | ⭕️ |
Type Generic | ❌ | ⭕️ | ❌ |
Goto | ❌ | ⭕️ | ⭕️ |
Data section | ❌ | ❌ | ⭕️ |
Section | ❌ | ❌ | ⭕️ |
Function | ⭕️ | ⭕️ | ❌ |
Readable | ⭕️ | ⭕️ | ⭕️ |
Word for operator | ❌ | ❌ | ⭕️ |
Exact equality operator | ⭕️ | ❌ | ⭕️ |
Samples
Hello world
#include <stdout.oba>
.main:
push Hello, world!
push msgln
call @
ret
What does this program do?
- Include stdout.oba (It contains section for output text with \r\n)
- Declare "This is main section"
- Push "Hello, world!"
- Push "msgln"
- Call "msgln"
- End program by exit code 0
99 Bottles of beer
#include <stdout.oba>
.data:
.empty
.empty
.empty
.decimal 100
.main:
mov 3,@
sub @,1
movd @,3
mov 3,@
push bottles of beer on the wall,
concat @,@
mov 3,@
push bottles of beer,
concat @,@
concat @,@
push msgln
call @
mov 3,@
sub @,1
movd @,3
push Take on down, pass it around,
push msgln
call @
mov 3,@
push bottles of beer on the wall
concat @,@
push msgln
call @
jmp 5
What does this program do?
- Include stdout.oba
- Declare "This is data section"
- Push empty / empty / empty / 100 to data section
- Declare "This is main section"
- Get value from Index 3
- Subtract it by 1
- Move value to data section
- Get value from Index 3
- Push " bottles of beer on the wall,"
- Concat
- Get value from Index 3
- Push " bottles of beer,"
- Concat
- Concat
- Push "msgln"
- Call "msgln"
- Get value from Index 3
- Subtract it by 1
- Move value to data section
- Push "Take on down, pass it around,"
- Push "msgln"
- Call "msgln"
- Get value from Index 3
- Push " bottles of beer on the wall"
- Concat
- Push "msgln"
- Call "msgln"
- Jump to line 5
Oh yeah something I didn't notice before, this only has instructions for things like mathematics and outputting to the terminal.
If you want to do anything other than that then you couldn't use this even if you wanted to.
@CSharpIsGud No, it has (not math) things.
what theforark said ot has other stuff
@TheForArkLD it has outputting to the screen, thats about it
@CSharpIsGud yes(this program), but it(lang) has other commands.
did you read document? you can read document from github.
@TheForArkLD yeah and the only thing the instructions do is
- math instructions like add sub mul div
- output things to the terminal
- store things in some data section to be outputted to the terminal since thats basically all that can be done with it
@TheForArkLD What it needs to be something you can use for a real project:
- A way to import C# functions to be able to interact with APIs like file io
- Standard libraries to interact with basic things like file io using the above
It's too late to add these things now but when the judging ends and you don't throw it away it needs them.
@CSharpIsGud huh, you didn't read document. read document again.
@TheForArkLD I am not talking about sections, it does not matter how many sections you make, there aren't any instructions for anything but stack, basic terminal output and math
@CSharpIsGud huh, talk to you is waste of time.
because you aren't reading document.
@TheForArkLD I READ THE DOCUMENT AND THAT IS WHAT IM POINTING OUT
@CSharpIsGud HUHHHH DID YOU SEE and
, or
, xor
, AND not
etc???
@TheForArkLD I count those as mathematical operators, they are bitwise operations. I am talking about instructions to import a C# function and call it, to make it possible to do things other than simply manipulating numbers
@CSharpIsGud A agree that it would be nice to have an FFI.
However, would you call x86 useless since it can only manipulate numbers?
@fuzzyastrocat btw, repl.it is x64.
@TheForArkLD x64 is really x86-64, so I just consider all those under the umbrella of "x86"
@fuzzyastrocat yes? yea yes.
@fuzzyastrocat x86 can edit memory, interact with serial ports, etc. It defines the basics of what everything can do, if all you could do is write numbers to the screen it would be useless
@CSharpIsGud Ah, I didn't realize Obratnaya was incapable of syscalls. Yes, I agree with you then.
@fuzzyastrocat Since obratnaya compiles to .NET bytecode even if he adds some way to import C# code it will be limited to what the .NET runtime can do.
What do you mean by "C# doesn't have an exact equality operator"?
(this is an honest question, I have almost no C# experience and want to know more about it)
@fuzzyastrocat ahhh ok
In JS: == compares values without compare type
In JS: === compares values with compare type
In C#: Has ==
In C#: No ===
@TheForArkLD Oh, interesting. That's kinda bad, I see why you included it here!
@fuzzyastrocat :D
(But In Obratnaya, == is =, === is ==.)
@TheForArkLD (Makes sense, since = doesn't mean assignment here)
@fuzzyastrocat yes, but it has define
for assignment
@TheForArkLD Right (that's what I meant by "= doesn't mean assignment here")
@TheForArkLD ...bratnaya :D
@fuzzyastrocat someone is saying same lmao
@fuzzyastrocat To explain better, C# is statically typed. therefor it doesn't need an exact equality operator as comparisons are already restricted to their own types except for a select few implicit conversions such as a char to an int, since an int can hold the same values as a char (0 - 255 | -127 - 127)
@CSharpIsGud Yeah, that makes sense...
Cookeylang is faster in my tests and is more versatile and why not just use assembly?
@Miner36 bc assembly makes long code
@Miner36 and this is installing packages before run
Nice!
@VulcanWM Thanks :D
I was looking at the files to see what it was like and when I opened the opm
file it almost crashed my chromebook! lol
@CarlosRosiles lmao it's binary
@CarlosRosiles hey i'm using a chromebook
Hello. Since you keep upvoting me for some reason I paid you back by upvoting on one of your posts.
@TheForArkLD is confused in I changed my username post
@AJDevelopment also i invited you to the team ADDCOOLNAMEHERE
@AJDevelopment yes and ok
@AJDevelopment ok, lets do thing by team!
@TheForArkLD Yeah, lets do it! two random imagined people jump and there's a freeze frame
c-assembler hybrid? Huh.. I wonder how the preprocessor works...
@TheForArkLD The C pre-processor? gcc -E
?
@TheForArkLD It basically replaces the #include
statements with the raw source code of the header files included, when you #define
something it replaces all instances of that reference to the value of the macro
@firefish ahhhh, so you want know how does #include
work?
@TheForArkLD in obratnaya yeah, I want to look at the source, but I can't find it easily, and my C# decompiler is acting up
@TheForArkLD Forgot to look at GitHub my question is answered
slft += File.ReadAllText(path).Split(new char[]{'\n'}).Length - 1;
all = (File.ReadAllText(path) + "\n" + Regex.Replace(code.Replace("\r",""),@"#include " + oldpath + "\n","")).Split(new char[]{'\n'});
code = File.ReadAllText(path) + "\n" + Regex.Replace(code.Replace("\r",""),@"#include " + oldpath + "\n","");
it works the same way as in c
@TheForArkLD bratnaya?
@TheForArkLD you said o
, and i said bratnaya
?
@firefish ahhhh ok
(btw my o
means oh
)
@TheForArkLD I know, it's just jokes are.... aaarrrggrhaghgharghgahghagrhghgrarghargharghagrhgarhgarhg,
@firefish yossss
Cool!
Suggestion: Make it compile to x86! Since it seems fairly low-level the translation probably wouldn't be hard (in some cases, near-direct translation might work). That way it would be blazingly fast and have a speed advantage
@fuzzyastrocat yea, but transpiler is failed 😭
i'll add transpiler 😁
@TheForArkLD Oh, you had a transpiler to x86? (That would be a compiler actually)
@fuzzyastrocat no lol
i transpiled Obratnaya to C#, and compiled it only.
@TheForArkLD Wait, now I'm confused. What do you mean by "compiled it only"?
@fuzzyastrocat ok look at this
1. transpile Obratnaya to C#
2. compile it to x86
@TheForArkLD Ok, so you do both/either? (either because you said you stopped the transpiling version)
@fuzzyastrocat either.
@TheForArkLD Ok, so you already compile. I understand now, sorry for the confusion! :D
@TheForArkLD C# doesn't compile to x86
@CSharpIsGud huh ur brain is bit old
use System.Reflection.Emit
@TheForArkLD https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit?view=netcore-3.1 Microsoft intermediate language (MSIL)
https://en.wikipedia.org/wiki/Common_Intermediate_Language
C# is compiled to a bytecode first, then it is run(JIT) by its vm(.NET runtime)
@CSharpIsGud oh, thanks for fix my brain
im cookeylang tbh
@RaidTheWeb ik but you helped me
@TheForArkLD final response = true;
@RaidTheWeeb well, grilled cookie is looking too grilled
Wait, you're @RaidTheWeb?! I thought you were @RaidTheWeeb the whole time lol
How'd you pronounce the name?
@DynamicSquid see docs in github :D
@DynamicSquid We've got some rivals eh?
indeed you do
@HahaYes Eh, Rex is higher level and actually has an advantage over most modern languages. (sorry, but this seems more like a hybrid between Assembly, C, Forth, and even some BASIC, but doesn't have an advantage over most modern languages including JS and Python...)
@AmazingMech2418 yes we do! Which one do we submit... rex or adaptX? Confusion?
@AmazingMech2418 we could split our teams to get a better chance...
@HahaYes Rex and AdaptX are the same thing. We changed the name to Rex, but the AdaptX repl is just C++ Rex.
@AmazingMech2418 ah ok we've also got some easter eggs
@HahaYes Nice! LOL! I'll make sure to add them to the JS version!
@HahaYes By the way, the JS version has functions now! Now, for returning values from the functions... LOL!
@AmazingMech2418 yessir.
Wow that's nice! Is there an in-depth instruction manual?
@HarperframeInc yes :D
you can see docs in github.
This is neat.
Seems like assembly
Now to see if its good enough for actual stuff...@nk1rwc 🤔