r/Compilers • • Jul 30 '26

I'm making a bytecode compiled language

14 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/Beginning-Tank-3770 Jul 31 '26

Hi Samuel

So yeah, the END and EXIT can be mixed up, but END is more like a marker instead of an instruction, both the JRM and the compiler needs to know where the code ends

The load example is a bit confusing, so let me try my best to explain

Each JRM program has its own memory space The memory space looks like this:

[CODE][STATIC DATA][STACK]

therefore, RSP and RDP are here

[CODE]<RDP>[STATIC DATA]<RSP>[STACK]

Which also kinda explains why I use END to initialize RDP

Thanks alot for your reply!

Here's the repo! https://github.com/NOOUBY-DEV/JSM

1

u/Longjumping-Jacket97 Jul 31 '26

What does JRM stand for??

1

u/Beginning-Tank-3770 Jul 31 '26

JSM Runtime Machine

1

u/Longjumping-Jacket97 Jul 31 '26

Isn't this just a bytecode assembler? It doesnt seem like a whole programming language which would use a pipeline of lexing->parsing->semantics(technically optional)->compiler

1

u/Beginning-Tank-3770 Jul 31 '26

Now that I think of it

Yes it's an assembler, as it's a very direct bytecode mapper. But given that the output is bytecode and not actually machine instructions, and it does go through parsing and syntax checking, then it a mix of a bytecode assembler and a compiler

Thanks for asking!

1

u/Samuel_Bouchard Aug 01 '26

Assembler do parse and check for syntax. It is the bare minimum for any program that takes in user code to transform it into something else. That's what assemblers and compilers do. The only difference is that an assembler takes in simple opcodes (assembly language) and directly turns them into binary, while a compiler takes in higher-level language programs, applies transformations on them to optimize them, then emits assembly code.