Suppose there is a script language called ScriptCode with the capabilities of execute code in same language.
//This ficticius program executes a simple constant code.
main()
{
ScriptCode sc=new ScriptCode ( "print \"Hello\"");
execute(sc);
print (" world");
}
//This ficticius program would read 10 programs from stdin and then execute them all.
main()
{
ScriptCode programs[10]
String input;
for(int i=0;i<10; i++)
{
input =readInput();
program[i] = new ScriptCode(input);
}
for( SriptCode p : programs)
execute( p );
}
The question is:
Which existent program language could “ScriptCode” be ?
or
How could this kind of software be implemented?
(I hope it’s not LISP the only choice, but if so.. I would have to face it.)
Thanks
your
executeroutine is traditionally calledeval. the wikipedia article on eval lists many languages that have an “eval”, including JavaScript, ActionScript, Lisp, Perl, PHP, Lua, PostScript, Python, D, ColdFusion, REALbasic, Ruby, Forth, VBScript, Visual Basic for Applications, and Smalltalk. SQL is also mentioned in comments below (thanks).typically, the implementation uses the same code as the language itself (to reduce duplication). so interpreted languages invoke the interpreter and compiled languages invoke the compiler. since the interpreter must be included with interpreted programs, but a compiler is often not included with compiled ones, this functionality is more common in interpreted languages.