advanced user output

This is a discussion on advanced user output within the C++ Programming forums, part of the General Programming Boards category; Hello I want to allow user to use advanced output feature with my application. In other words I want to ...

  1. #1
    l2u
    l2u is offline
    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,672
    You might be able to cobble something together using a stringstream.
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    753
    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
    l2u
    l2u is offline
    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, 05:01 AM
  5. sorting output on student info program
    By indigo0086 in forum C++ Programming
    Replies: 2
    Last Post: 11-05-2002, 10:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21