Basic-Like PCODE Compiler and Virtual Host/Interpreter

chris.cranford@tkdsoftware.com (JA Peele)
21 Apr 2004 00:51:28 -0400

          From comp.compilers

Related articles
Basic-Like PCODE Compiler and Virtual Host/Interpreter chris.cranford@tkdsoftware.com (2004-04-15)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter tdk@thelbane.com (Timothy Knox) (2004-04-21)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter bonzini@gnu.org (2004-04-21)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter lex@cc.gatech.edu (Lex Spoon) (2004-04-21)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter alex@iliasov.org (2004-04-21)
Basic-Like PCODE Compiler and Virtual Host/Interpreter chris.cranford@tkdsoftware.com (2004-04-21)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter chris.cranford@tkdsoftware.com (2004-04-28)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter chris.cranford@tkdsoftware.com (2004-04-28)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter kenrose@tfb.com (Ken Rose) (2004-04-28)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter freitag@alancoxonachip.com (Andi Kleen) (2004-04-28)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter arargh404@NOW.AT.arargh.com (2004-04-29)
Re: Basic-Like PCODE Compiler and Virtual Host/Interpreter alex_mcd@btopenworld.com (Alex McDonald) (2004-05-02)
[3 later articles]
| List of all articles for this month |
From: chris.cranford@tkdsoftware.com (JA Peele)
Newsgroups: comp.compilers
Date: 21 Apr 2004 00:51:28 -0400
Organization: http://groups.google.com
Keywords: interpreter
Posted-Date: 21 Apr 2004 00:51:28 EDT

I am looking for some hints/tips or possibly source if its available
(even as a guide) to explain how I can complete the following tasks.
Any input is greatly appreciative:


I need to embed a BASIC-like BYTECODE/PCODE host engine in my
application framework so customers can write simple BASIC-like scripts
to customize the application. An example of a BASIC-Like script would
be:


    // Test script
    Dim x as Integer = 2
    Print "Hello World From my test script."
    Print "X was initialized to a value of "; x


What I am expecting to do is have the customer save the above in a
file, for example called test.bas. The customer would have a tool
that does syntax, compiler analysis on the code and would notify them
of where syntax errors exist in the code. If all the syntatical
checks pass, the contents of the source file are then stored in a
bytecode/pcode type file like test.pbc.


In my C++ program, I could then create a host VM environment, pass the
VM the pcode/bytecode filename and it would execute the instructions
in realtime. Here is what I would expect in my C++ application:


    const MAX_MEMORY_SIZE=1024*32; // 32k
    CBasicVM* pVM = new CBasicVM(MAX_MEMORY_SIZE);
    if (pVM != NULL)
    {
        // args is a character string of arguments that are passed
        // into the host VM environment as parameters to the program
        // being executed.
        // ie: test.pbc [arg1] [arg2] [arg3] ... [argX]
        if(pVM->Run("test.pbc", args))
            printf("Virtual machine ran program ok.\n");
        else
            printf("Virtual machine detected errors during runtime.\n");


        delete pVM;
        pVM = NULL;
    }


Can anyone help with this topic? If this isn't applicable for this
newsgroup, please let me know which is applicable.


Thanks in advance!
Chris


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.