VividScript

posted in AntRWells
Published November 06, 2018
Advertisement

Resumed work on Vivid-Script. Vivid-Script is a managed, real time scripting language. It is wrote for Vivid3D, and as such will not just be a normal language with a set of functions,

it will instead offer several features that connect closely with the engine. It works on a dynamic engine. i.e, it uses a lot of the C# dynamics feature, so that code is clean and safe, by ensuring there are no mis-matches before running.

here is a simple script, that runs fine. and also there is the code to run it in c#


module TestModule

    int testVal

end

func Entry(int age,string name)

    printf("Hey testing!"+" Oh yeah!"+" This is working!")

end 

And here is the code to run it,


  VSource src = new VSource("test1.vs");
            VCompiler comp = new VCompiler();
            VCompiledSource s = comp.Compile(src);

            VME test_vme = new VME();

            test_vme.SetEntry ( s.EntryPoint );

            test_vme.RunEntry ( );

And here is the function that registers C# methods/code to the language, so it can connect to normal C# methods easily.

 


 public void RegisterOSFuncs ( )
        {
            // - printF( <Expressions> )

            CFuncLink printF = new CFuncLink
            {
                Link = ( t ) =>
                {
                    Console.WriteLine ( "printF:" + t[0]);

                    return null;
                }
            };

            AddCFunc ( "printf", printF );
        }

 

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement