DevLog#11 — I have added variables to the bytecode compiler and the vm. Mostly, it was easy, but the assigning char := was a bit tricky to implement in the bytecode compiler and the vm. I made a global environment for setting and getting the values in the variables. I must now focus on implementing / adding strings, arrays, and hashes. Wish me luck……
Comments 6
Compilers are cool. I made a compiler once, but it couldn’t support strings or arrays.
@obedot Well, according to my experience, it mostly depends on the frontend ( tokens, ast, parser, and object ) when supporting types.
Yeah, but for strings or arrays, you might have to think about memory management and pointers and all that stuff if you haven’t already. I hadn’t, I just had basic integer types, so strings would be harder to implement.
@obedot You are right, it really depends on the memory management, but for my current implementation, I didn’t think about memory management since I used Go and Go has a garbage collector ( GGC ).
Well, I meant, it might be difficult to think about how your compiled executable manages memory. In your language that you’re making a compiler for, do you have to write a garbage collector, or does the programmer have to manually free memory?
In the current phase of developing my language, I am building a bytecode compiler and VM for the interpreter. Since I’m using Go, I don’t need to worry about memory management because Go gives me a built-in garbage collector, so I don’t have to build one myself. However, this will impact performance, as manual memory management would be faster.
Sign in to join the conversation.