Click here to Skip to main content
15,924,195 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMaking an Application Still Image-Aware Pin
shlim881-Oct-03 16:31
shlim881-Oct-03 16:31 
GeneralI need to make this more compact. Pin
esepich1-Oct-03 14:13
esepich1-Oct-03 14:13 
GeneralRe: I need to make this more compact. Pin
Maximilien1-Oct-03 14:30
Maximilien1-Oct-03 14:30 
GeneralRe: I need to make this more compact. Pin
Terry O'Nolley1-Oct-03 15:34
Terry O'Nolley1-Oct-03 15:34 
GeneralRe: I need to make this more compact. Pin
Anthony_Yio1-Oct-03 16:04
Anthony_Yio1-Oct-03 16:04 
GeneralRe: I need to make this more compact. Pin
Mike Dimmick2-Oct-03 4:29
Mike Dimmick2-Oct-03 4:29 
GeneralParser/Compiler Pin
Kuniva1-Oct-03 10:17
Kuniva1-Oct-03 10:17 
GeneralRe: Parser/Compiler Pin
Ravi Bhavnani1-Oct-03 10:32
professionalRavi Bhavnani1-Oct-03 10:32 
Ah, this is brings back fond memories... One of my MS theses (circa 1984) was a virtual computer that included a parser for a (very simple) high level language. The compiler generated assembly language code which was run thru the virtual machine's interpreter.

Anyway, to answer your question, here are the basic steps you'd need to take:
  1. Define the grammar for your language
  2. Write a lexical analyzer that spits out language tokens
  3. Write a parser that creates a parse tree from a stream of tokens
  4. Write a code generator that translates a parse tree into machine instructions
  5. Optional: write an optimizer to optimize the machine instructions
I strongly recommend looking at a decent book on the subject. I used the Dragon Book[^] eons ago.

Writing a compiler is a labor of love and imho, a necessary part of learning and appreciating Computer Science. (Learning assembly language is like learning geometry - we do it because it teaches us how to think).

Good luck and have fun!

/ravi

Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: Parser/Compiler Pin
parths1-Oct-03 18:07
parths1-Oct-03 18:07 
GeneralRe: Parser/Compiler Pin
valikac1-Oct-03 10:32
valikac1-Oct-03 10:32 
GeneralRe: Parser/Compiler Pin
Kuniva2-Oct-03 4:52
Kuniva2-Oct-03 4:52 
GeneralRe: Parser/Compiler Pin
David Crow1-Oct-03 10:35
David Crow1-Oct-03 10:35 
GeneralRe: Parser/Compiler Pin
Ravi Bhavnani1-Oct-03 10:36
professionalRavi Bhavnani1-Oct-03 10:36 
GeneralRe: Parser/Compiler Pin
Mike Dimmick1-Oct-03 12:06
Mike Dimmick1-Oct-03 12:06 
GeneralMinimizing command.com window called with system() Pin
Member 5045041-Oct-03 9:17
Member 5045041-Oct-03 9:17 
GeneralRe: Minimizing command.com window called with system() Pin
OBRon1-Oct-03 9:47
OBRon1-Oct-03 9:47 
GeneralRe: Minimizing command.com window called with system() Pin
Member 5045043-Oct-03 7:04
Member 5045043-Oct-03 7:04 
GeneralRe: Minimizing command.com window called with system() Pin
Neville Franks1-Oct-03 10:26
Neville Franks1-Oct-03 10:26 
GeneralRe: Minimizing command.com window called with system() Pin
Member 5045043-Oct-03 7:05
Member 5045043-Oct-03 7:05 
GeneralInitializing Static Variables in C++ Libraries Pin
sjcomp1-Oct-03 8:23
sjcomp1-Oct-03 8:23 
GeneralRe: Initializing Static Variables in C++ Libraries Pin
Joaquín M López Muñoz1-Oct-03 9:42
Joaquín M López Muñoz1-Oct-03 9:42 
GeneralRe: Initializing Static Variables in C++ Libraries Pin
sjcomp1-Oct-03 10:00
sjcomp1-Oct-03 10:00 
GeneralRe: Initializing Static Variables in C++ Libraries Pin
Joaquín M López Muñoz1-Oct-03 10:12
Joaquín M López Muñoz1-Oct-03 10:12 
GeneralRe: Initializing Static Variables in C++ Libraries Pin
sjcomp1-Oct-03 10:33
sjcomp1-Oct-03 10:33 
GeneralRe: Initializing Static Variables in C++ Libraries Pin
Joaquín M López Muñoz1-Oct-03 11:28
Joaquín M López Muñoz1-Oct-03 11:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.