Thread: scripts files

  1. #1
    Registered User
    Join Date
    Apr 2005

    scripts files

    i want to build a program which can load script files.
    the script files will tell it to open window, send data through winsock - anything. for example: script for sending message will tell the program to open dialog box for the input text and then send the text.
    the scripts should be on seperate files so i can release new scripts that can be used by the program instead of changing the program itself.
    i need ideas on how it suppose to be done (not exactly the code - just the general idea).

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well the first step is to write out the grammar for your script. How complicated you make this is up to you.

    window <title> [,<position]
    open <address|url>
    open and window are keywords
    window has a title, and an optional position
    open has an address or a URL

    A simple line-oriented parser (one keyword and associated parameters per line) is simple enough to roll your own parser. But anything complex (say loops, block structure, variables, functions, ...) you'd probably be looking at lex and yacc (or flex and bison)
    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. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 03:28 AM
  2. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  4. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  5. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 03:16 AM