Thread: advanced user output

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    advanced user output

    Hello

    I want to allow user to use advanced output feature with my application. In other words I want to have some simple scripting language inside c++ application so that user could call c++ functions from this simple scripting language.

    Is there anything similar available?
    I know for boost python, but to embed python interpreter in c++ makes binary for about 1mb bigger. I want to keep my exe as smallest as possible.

    User should be able to do something like this (for instance):

    Code:
    %c = random(2,5);
    %b = "some text";
    output = "this is" . %b . "... some random number: " . %c;
    And when my c++ aplication would parse this script, it would make the output string:
    "this is some text... some random number: 3"

    Thanks for help

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    You might be able to cobble something together using a stringstream.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    The problem as stated is basically the problem of writing a compiler, which is pretty heavy stuff. So, my suggestion...

    If you want a lightweight scripting language... LUA might be the one for you.
    If you want to roll your own, the simplest way to go about it is to make a stack-based language, aka, one built around Reverse Polish Notation.
    Callou collei we'll code the way
    Of prime numbers and pings!

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    630
    I dont want to roll my own since that would take too much time to make something that will actually 'work'.
    I have also found out CLiPP - javascript interpreter, which uses boost libraries but I cant compile it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pausing output window
    By kristopher in forum C Programming
    Replies: 3
    Last Post: 08-01-2007, 03:39 AM
  2. Connecting input iterator to output iterator
    By QuestionC in forum C++ Programming
    Replies: 2
    Last Post: 04-10-2007, 02:18 AM
  3. why this output?
    By dredre in forum C Programming
    Replies: 4
    Last Post: 05-08-2004, 04:09 PM
  4. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM
  5. sorting output on student info program
    By indigo0086 in forum C++ Programming
    Replies: 2
    Last Post: 11-05-2002, 11:29 AM