Advertisement

Links to building a compiler?

Started by September 09, 2000 07:46 PM
6 comments, last by Dire.Wolf 24 years, 3 months ago
I''m looking for the following links: * How to write your own source-to-bytecode compiler and virtual machine. I know flipcode.com has a tutorial but it doesn''t show anything about objects or structures. * Does anyone have any links to building an object-oriented compiler with implementation examples right up and possibly including assembly generation. * Scripting language + source code? I''m just doing some light research in the area and was wondering if any of you have come across this stuff... Thanks in advance, - Dire Wolf direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
You might want to check out "Lex and Yacc"

Advertisement
Why would you want to make your own compiler?

=======================================
A man with no head is still a man.
A head with no man is plain freaky.
Why do people climb Mt. Everest? To see if they can. The real reason is that I would like to implement my own scripting language and have a virtual machine run it.

- Dire Wolf
direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
Why do people climb Mt. Everest? Not to see if they can. Anyone can. It''s a question of how much of a risk-taker you are. Whether you''re scared or brave. Making a compiler doesn''t have such deep emotions.

=======================================
A man with no head is still a man.
A head with no man is plain freaky.
Man Zipster ... such a limited view. first of all ... nearly all major development houses write their own little languages (scripting / control / whatever) for use in in-house develpment. Many times the tools which manipulate such languages are simple text editors, and the result of their operation is hard-coded high-level logic ... but once you''ve learned how to use tools like lex and yacc (or flex and bison ... or visual parse ++ and whatever backend you use with it), then you''ll realize .. making a language is not hard .. and VERY usefull ... Quake III has a language, Starsiege Tribes has one. My little dinky gambling game project has TWO and a META language (which provides validation rules for one of the languages) ... its such a general purpose thing to do .. i almost can''t believe you''d ask WHY ok .. now this WAS a rant ... so I''ll quit ... AND ... I''ll additionally say most user have no need to write a compiler that converts to back end or assembly code. IF you are making a virtual machine ... then you are defining it''s byte-code .. so YOU choose how to make it work ...just figure out what operations your VM needs to do (which is easy till you start think about DECLARING variables and such ... that''s where you need compiler strategies, otherwise your just dealing with logic branches). I''ll post more .. after I get some feedback and some energy
Advertisement
You could try Gentle, a widely known and well documented compiler generation system (besides lexx and yacc, which it is based on, btw).
www.first.gmd.de/gentle

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
You might want to check out Jack Crenshaw's "Let's Build a Compiler!" series of tutorials. It's here.

quote:
Why would you want to make your own compiler?


Zipster, why do you make games? There are plenty of games for you to play, why bother to make your own? It's an interesting challenge to do something like this, it can also be quite fun

Edited by - Muzzafarath on September 10, 2000 6:46:27 AM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement