Firstly, I am not sure if this is the best place to ask the query. If no, please move it to the correct subforum.

Now, coming to my doubt, an assembler converts assembly language into opcodes, right? Now, to perform the conversion, assembler needs a certain algorithm. Whats the algorithm written in? Because if its written in a certain language, wouldnt we need assembler again to convert this algorithm to opcodes? Doesnt this lead to an infinite loop? Where does this process stop?

The assembler would be written in another language first, possibly a different assembly language or even a higher level language like C. Then it's not uncommon after that for the assembler to compile/bootstrap itself as a way of shaking out bugs and proving viability of the tool.

And since it's a common question, the first compiler/assembler ever must have been written directly in machine code.

Thanks for the reply. :)

btw, when you say it "'must' have been written", are you too sure about it, or are you not too sure about it. If you are sure, could you possible give an example of the compiler/assembler written in machine language and another compiler/assembler which uses the machine language compiler/assembler to compile itself? (hope this does not sound too confusing :P)

Thanks.

when you say it "'must' have been written", are you too sure about it, or are you not too sure about it.

I'm sure enough because that's the only way it could have happened.

If you are sure, could you possible give an example of the compiler/assembler written in machine language

No, because that's way back when it would have been written using punch cards or some even older format. We're talking about primordial stuff happening in the 1940s/1950s here. It's not exactly well documented, but you could search Google.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.