Julieta Shem <
js...@yaxenu.org> wrote:
> Vansh Kapoor <
kapoorv...@gmail.com> writes:
>
> > I was reading this book 'Computer Systems'
>
> Is it interesting? Who are the authors?
>
> > and it made me wander if the compiler exists in Operating system or it
> > can individualy work with the processor main memory and I/O bridges.
>
> It's not clear if you mean running the compiler without an operating
> system of if the compiler is able to produce a program that can run
> without an operating system. I think you mean the former---can the
> compiler bootstrap the computer system and offer an interface to the
> user to write programs, compile and run them? This would make the
> compiler also be a text editor and a shell, essentially replacing the
> entire operating system. That's not what typical compilers are.
It really depends on the nature of your I/O. A compiler transforms source
code into object code (or machine code). With a modern compiler the source
and machine code are stored in files so you need something to provide a file
abstraction, which we call an OS. But I could imagine where you fed in
first the compiler binary on paper tape, then your source code on another
tape. This prints a tape holding the machine code output. Then you feed
that tape back into the machine to run it.
If you could do a modern reimagination of that idea you could have it work
without an OS. But it's hard to see why you would want to.
You could also implement file handling inside the compiler, so the compiler
talks to the storage directly to fetch files, and has the ability to load
and execute compiled code itself. But that's really just embedding OS
functions inside the compiler.
Theo