Thread: Interpreter.. Where to start? [Compiler]

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    64

    Interpreter.. Where to start? [Compiler]

    So we are to create a compiler for our own programming language. We now have a scanner, and parser.

    Now, I don't know where to start for the interpreter. Can anyone here help me give me some head start. I'm google it but can't find any specifics.

    Thank you,
    sarah22

  2. #2
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    Have you gone through the dragon book?
    Let's Build a Compiler looks like an interesting non technical read but it's a bit dated though.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    64
    I can't find anyway on how to interpret a code after the parser successfully check the grammar. The sample on the book is so simple. Mine has a code like C. or maybe I miss anything?

    Ex:
    int i = 2*3;
    int j = i*2;

    so how the hell I'll tell my interpreter those? and updating my symbol table manager.

    The tokens has this
    int <- datatype
    i <- identifier
    = <- assignment
    2 <- numeric
    * <- multiply
    3 <- numeric
    ;
    int <- dataype
    j <- identifier
    = <- assignment
    i <- identifier
    * <- multiply
    2 <- numeric
    ;

    Thank you,
    Sarah

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well you could try reading part2 of the tutorial that was posted a week ago.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to start
    By iprecious in forum General Discussions
    Replies: 4
    Last Post: 04-10-2010, 07:32 PM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  3. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  4. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  5. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM