Thread: getting started with parsing...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    244

    getting started with parsing...

    Hey all, I'd like to be able to write a program in which a user can input text such as "open north" and it will open the door to the north... you know, like Zork or a MUD.

    But of course I need to know how to parse strings to find certain words and then use a hash table to use the correct function (if memory serves me), and that's about ALL I know about command parsing.

    If someone could get me started or provide a helpful link I'd be indebted!

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I like a parsing loop. One character at a time. you use each character to "walk" down a keyword tree/dictionary. When you hit a node you have a complete keyword. Every keyword hit puts you in a new state. Get what I'm saying? of course it can get REALLY complicated if you're not doing a simple language but for ZORK it should work just fine.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Do a search for Spirit and C++ and parsing, its a very cool c++ parsing library, very easy to use, and very well documented.

    Unless you are after a learning experience.
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need sth about parsing
    By Masterx in forum C++ Programming
    Replies: 6
    Last Post: 11-07-2008, 12:55 AM
  2. draw tree graph of yacc parsing
    By talz13 in forum C Programming
    Replies: 2
    Last Post: 07-23-2006, 01:33 AM
  3. Parsing for Dummies
    By MisterWonderful in forum C++ Programming
    Replies: 4
    Last Post: 03-08-2004, 05:31 PM
  4. How to get started?
    By anoopks in forum Linux Programming
    Replies: 0
    Last Post: 01-14-2003, 03:48 AM
  5. I hate string parsing with a passion
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-19-2002, 07:30 PM