News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Is there a tutorial or posting for writing an assembler or compiler with steps??

Started by lord_raven, October 03, 2021, 03:10:00 PM

Previous topic - Next topic

lord_raven

Hi, My name is raven.  I am interested in making a assembler/compiler in masm and wonder if anyone knows where to find the good material. I have done a lot of looking on google and it seems masm tutorials are far and few. I have seen there is a posting area for this topic further down but it doesn't look like there are any good references yet!!!

jj2007

Hi Raven,

Welcome to the Forum :thup:

Here is some material to get started. The Masm32 SDK is already kind of a compiler:
include \masm32\include\masm32rt.inc ; plain Masm32 for the fans of pure assembler
.code
start:
.if rv(MessageBox, 0, "Is this a compiler?", "Masm32 SDK:", MB_YESNO)==IDYES
print "Yes, it is"
.else
print "No, it isn't"
.endif
inkey "- hit any key"
exit
end start


More sophisticated stuff is possible. Let us know what exactly you want to achieve, and what your current background and state of knowledge are.

hutch--

Starting from scratch, I think you are in trouble. To use MASM as a tool to design an assembler or compiler means years of experience and then more years of experience in compiler/assembler design. I would suggest you look at some of the C options as from memory years ago, the Linux guys has a basic package to start a C compiler. You will have to search Google to see if you can find it.

fearless

Might be useful:

Developing a C Compiler from scratch: https://www.twitch.tv/therealnibblebits

Also worth looking for a book called Compilers : principles, techniques, and tools (Alfred V.  Aho, Monica S. Lam, Ravi  Sethi, Jeffrey D. Ullman) - also known as the Dragon book

lord_raven

I actually have about 80% of a compiler written in c, for a language i am building. I asking more about some good masm tutorials on different subjects. google pulls up a lot of 404, lol. I have used nasm for awhile so I am kind of familiar with the process in asm, but just started really trying to work in masm. Doing things the window or vs way. Id like to start connecting my ast into masm instead of the gas i am currently using.

hutch--

If you are that far along with the task, learning MASM should be no big deal, it uses traditional Intel notation and has a powerful but treacherous preprocessor that does take a lot of practice. You should be able to use MASM with a C compiler, as long as they both use the same object module format, with M$ VC and MASM, they both use Microsoft COFF format.

lord_raven

Quote from: fearless on October 04, 2021, 06:24:00 AM
Might be useful:

Developing a C Compiler from scratch: https://www.twitch.tv/therealnibblebits

Also worth looking for a book called Compilers : principles, techniques, and tools (Alfred V.  Aho, Monica S. Lam, Ravi  Sethi, Jeffrey D. Ullman) - also known as the Dragon book

Quote from: lord_raven on October 04, 2021, 09:08:45 AM
Actually looks pretty interesting, the website!!! Ill check it out