Thread: how would u....

  1. #1
    .............
    Guest

    how would u....

    i have to make a compiler like program that reads a program from file, counts the number of identifiers(constants,variables,functions) and adds the number of occurences of each identifier including line numbers and identifier names to a binary tree and then displays the results in a sorted order......im unsure where to start or how its done any suggestions would be gr8....thanks

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >im unsure where to start
    A good starting point would be a legal pad, draw out what you want to do and toy with different ways of doing it until you find something you like. It would also be a good idea to have the binary tree up and working properly so that you don't have to worry about it when writing the rest of the parser.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Get your binary tree up and running first then build in the file operations and string tokenising then you are about 90% done.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    http://www.aihorizon.com has some good ways of doing stuff like this. Check them out.

Popular pages Recent additions subscribe to a feed