Share your Programming Language Jam submissions here!

← Back to all posts
Obratnaya
h
TheForArkLD (734)

Obratnaya repl
Source
@SixBeeps @RaidTheWeb @NoNameByProgram Here is post!

Table for features

JavaScriptC#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?

  1. Include stdout.oba (It contains section for output text with \r\n)
  2. Declare "This is main section"
  3. Push "Hello, world!"
  4. Push "msgln"
  5. Call "msgln"
  6. 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?

  1. Include stdout.oba
  2. Declare "This is data section"
  3. Push empty / empty / empty / 100 to data section
  4. Declare "This is main section"
  5. Get value from Index 3
  6. Subtract it by 1
  7. Move value to data section
  8. Get value from Index 3
  9. Push " bottles of beer on the wall,"
  10. Concat
  11. Get value from Index 3
  12. Push " bottles of beer,"
  13. Concat
  14. Concat
  15. Push "msgln"
  16. Call "msgln"
  17. Get value from Index 3
  18. Subtract it by 1
  19. Move value to data section
  20. Push "Take on down, pass it around,"
  21. Push "msgln"
  22. Call "msgln"
  23. Get value from Index 3
  24. Push " bottles of beer on the wall"
  25. Concat
  26. Push "msgln"
  27. Call "msgln"
  28. Jump to line 5
Commentshotnewtop
DungeonMaster00 (149)

This is neat.

Seems like assembly

Now to see if its good enough for actual stuff...
CSharpIsGud (646)

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.

TheForArkLD (734)

@CSharpIsGud No, it has (not math) things.

k9chelsea2 (707)

what theforark said ot has other stuff

CSharpIsGud (646)

@TheForArkLD it has outputting to the screen, thats about it

TheForArkLD (734)

@CSharpIsGud yes(this program), but it(lang) has other commands.
did you read document? you can read document from github.

CSharpIsGud (646)

@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
CSharpIsGud (646)

@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.

TheForArkLD (734)

@CSharpIsGud huh, you didn't read document. read document again.

CSharpIsGud (646)

@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

TheForArkLD (734)

@CSharpIsGud huh, talk to you is waste of time.
because you aren't reading document.

CSharpIsGud (646)

@TheForArkLD I READ THE DOCUMENT AND THAT IS WHAT IM POINTING OUT

TheForArkLD (734)

@CSharpIsGud HUHHHH DID YOU SEE and, or, xor, AND not etc???

CSharpIsGud (646)

@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

fuzzyastrocat (1297)

@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 (1297)

@TheForArkLD x64 is really x86-64, so I just consider all those under the umbrella of "x86"

CSharpIsGud (646)

@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

fuzzyastrocat (1297)

@CSharpIsGud Ah, I didn't realize Obratnaya was incapable of syscalls. Yes, I agree with you then.

CSharpIsGud (646)

@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.

fuzzyastrocat (1297)

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)

TheForArkLD (734)

@fuzzyastrocat ahhh ok
In JS: == compares values without compare type
In JS: === compares values with compare type
In C#: Has ==
In C#: No ===

fuzzyastrocat (1297)

@TheForArkLD Oh, interesting. That's kinda bad, I see why you included it here!

TheForArkLD (734)

@fuzzyastrocat :D
(But In Obratnaya, == is =, === is ==.)

fuzzyastrocat (1297)

@TheForArkLD (Makes sense, since = doesn't mean assignment here)

TheForArkLD (734)

@fuzzyastrocat yes, but it has define for assignment

fuzzyastrocat (1297)

@TheForArkLD Right (that's what I meant by "= doesn't mean assignment here")

CSharpIsGud (646)

@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)

TheForArkLD (734)

I am thinking what is that message for

Miner36 (18)

Cookeylang is faster in my tests and is more versatile and why not just use assembly?

TheForArkLD (734)

@Miner36 bc assembly makes long code

TheForArkLD (734)

@Miner36 and this is installing packages before run

[deleted]

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

AJDevelopment (83)

Hello. Since you keep upvoting me for some reason I paid you back by upvoting on one of your posts.

AJDevelopment (83)

@TheForArkLD is confused in I changed my username post

AJDevelopment (83)

@AJDevelopment also i invited you to the team ADDCOOLNAMEHERE

AJDevelopment (83)

@TheForArkLD Yeah, lets do it! two random imagined people jump and there's a freeze frame

firefish (794)

c-assembler hybrid? Huh.. I wonder how the preprocessor works...

firefish (794)

@TheForArkLD The C pre-processor? gcc -E?

firefish (794)

@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

TheForArkLD (734)

@firefish ahhhh, so you want know how does #include work?

firefish (794)

@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

firefish (794)

@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

firefish (794)

@TheForArkLD you said o, and i said bratnaya?

TheForArkLD (734)

@firefish ahhhh ok
(btw my o means oh)

firefish (794)

@TheForArkLD I know, it's just jokes are.... aaarrrggrhaghgharghgahghagrhghgrarghargharghagrhgarhgarhg,

fuzzyastrocat (1297)

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

TheForArkLD (734)

@fuzzyastrocat yea, but transpiler is failed 😭
i'll add transpiler 😁

fuzzyastrocat (1297)

@TheForArkLD Oh, you had a transpiler to x86? (That would be a compiler actually)

TheForArkLD (734)

@fuzzyastrocat no lol
i transpiled Obratnaya to C#, and compiled it only.

fuzzyastrocat (1297)

@TheForArkLD Wait, now I'm confused. What do you mean by "compiled it only"?

TheForArkLD (734)

@fuzzyastrocat ok look at this
1. transpile Obratnaya to C#
2. compile it to x86

fuzzyastrocat (1297)

@TheForArkLD Ok, so you do both/either? (either because you said you stopped the transpiling version)

fuzzyastrocat (1297)

@TheForArkLD Ok, so you already compile. I understand now, sorry for the confusion! :D

TheForArkLD (734)

@CSharpIsGud huh ur brain is bit old
use System.Reflection.Emit

TheForArkLD (734)

@CSharpIsGud oh, thanks for fix my brain

firefish (794)

@RaidTheWeeb well, grilled cookie is looking too grilled

firefish (794)

Wait, you're @RaidTheWeb?! I thought you were @RaidTheWeeb the whole time lol

DynamicSquid (4393)

How'd you pronounce the name?

HahaYes (1250)

@DynamicSquid We've got some rivals eh?

AmazingMech2418 (941)

@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...)

HahaYes (1250)

@AmazingMech2418 yes we do! Which one do we submit... rex or adaptX? Confusion?

HahaYes (1250)

@AmazingMech2418 we could split our teams to get a better chance...

AmazingMech2418 (941)

@HahaYes Rex and AdaptX are the same thing. We changed the name to Rex, but the AdaptX repl is just C++ Rex.

HahaYes (1250)

@AmazingMech2418 ah ok we've also got some easter eggs

AmazingMech2418 (941)

@HahaYes Nice! LOL! I'll make sure to add them to the JS version!

AmazingMech2418 (941)

@HahaYes By the way, the JS version has functions now! Now, for returning values from the functions... LOL!

HarperframeInc (390)

Wow that's nice! Is there an in-depth instruction manual?

TheForArkLD (734)

@HarperframeInc yes :D
you can see docs in github.