I'm new to programming and currently diving into Python, C, and computer architecture. I'm trying to follow a project on GitHub about building a compiler, but I have a couple of questions:
1. If my processor isn't x86-64, can I still build the compiler? What are my options?
2. The project recommends using Lubuntu 18.04, which I read isn't supported. If I choose a different operating system, will I still be able to follow along and build the compiler?
I found some info about cross-compiling to macOS, and I'm curious if I should just run some sort of VM or container setup to go through the process instead of installing Linux directly on my machine. Any advice would be appreciated!
3 Answers
The tutorial will build x86-64 executables, and it's easier to follow if you stick with an x86-64 environment, whether emulated or not. About Lubuntu, you can choose any Linux distro that fits your needs. Just make sure it includes the essential tools (like make, cc, and nasm) to get started with compiling. Emulators can help you run the tutorial's programs, but be prepared for some compatibility hurdles depending on your setup.
A VM simulates an entire machine while a container uses the host OS’s kernel. VMs can be more resource-heavy, but they fully mimic an environment.
I'd recommend starting with an interpreter first if you're feeling overwhelmed by building a compiler; it’s a tough project that requires a solid understanding of algorithms and data structures. Once you're more comfortable, you could transition to a compiler later on. As for the environment, using a VM or a container can be a good choice to replicate the tutorial environment without altering your main OS.
That makes sense! I might start with an interpreter. Any resources you'd recommend?
Look for introductory tutorials on building simple interpreters or check online coding platforms for courses.
If your processor isn't x86-64, you can still build the compiler, but the binaries it produces won't run natively on your machine. If you have an ARM processor, that could work since the project targets ARM as well. As for using Lubuntu 18.04, yes, it's outdated, and if you can't use it, any other mainstream Linux distribution should work as long as you have the necessary tools like a compiler and assembler.
What do you suggest for a good Linux distro? I heard Ubuntu is a solid choice.
Ubuntu is great! It's user-friendly and has a lot of support, so I'd recommend starting there.

I want to get this right! So a VM would work, but what's the difference between that and a container for this project?