2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,6 +1,9 @@
Demonstrate your language's ability for programs to execute code written in the language provided at runtime.
Show us what kind of program fragments are permitted (e.g. expressions vs. statements), how you get values in and out (e.g. environments, arguments, return values), if applicable what lexical/static environment the program is evaluated in, and what facilities for restricting (e.g. sandboxes, resource limits) or customizing (e.g. debugging facilities) the execution.
;Task:
Demonstrate a language's ability for programs to execute code written in the language provided at runtime.
Show what kind of program fragments are permitted (e.g. expressions vs. statements), and how to get values in and out (e.g. environments, arguments, return values), if applicable what lexical/static environment the program is evaluated in, and what facilities for restricting (e.g. sandboxes, resource limits) or customizing (e.g. debugging facilities) the execution.
You may not invoke a separate evaluator program, or invoke a compiler and then its output, unless the interface of that program, and the syntax and means of executing it, are considered part of your language/library/platform.
For a more constrained task giving a specific program fragment to evaluate, see [[Eval in environment]].
<br><br>

View file

@ -0,0 +1,5 @@
10 LET f$=CHR$ 187+"(x)+"+CHR$ 178+"(x*3)/2": REM LET f$="SQR (x)+SIN (x*3)/2"
20 FOR x=0 TO 2 STEP 0.2
30 LET y=VAL f$
40 PRINT y
50 NEXT x

View file

@ -0,0 +1 @@
10 LET f= SQR (x)+SIN (x*3)/2

View file

@ -0,0 +1 @@
10 LET f$=" SQR (x)+SIN (x*3)/2"

View file

@ -0,0 +1,6 @@
iex(1)> Code.eval_string("x + 4 * Enum.sum([1,2,3,4])", [x: 17])
{57, [x: 17]}
iex(2)> Code.eval_string("c = a + b", [a: 1, b: 2])
{3, [a: 1, b: 2, c: 3]}
iex(3)> Code.eval_string("a = a + b", [a: 1, b: 2])
{3, [a: 3, b: 2]}

View file

@ -1,2 +1,4 @@
use MONKEY-SEE-NO-EVAL;
my ($a, $b) = (-5, 7);
my $ans = eval 'abs($a * $b)'; # => 35
my $ans = EVAL 'abs($a * $b)'; # => 35

View file

@ -1,22 +1,20 @@
/*REXX program illustrates ability to execute code entered at "runtime".*/
numeric digits 10000000 /*ten million digits should do it*/
/*REXX program illustrates the ability to execute code entered at runtime (from C.L.)*/
numeric digits 10000000 /*ten million digits should do it. */
bee=51
stuff= 'bee=min(-2,44); say 13*2 "[from inside the box.]"; abc=abs(bee)'
interpret stuff
say 'bee=' bee
say 'abc=' abc
say 'bee=' bee
say 'abc=' abc
say
/* [↓] now, we hear from da user*/
/* [↓] now, we hear from the user. */
say 'enter an expression:'
pull expression
say
say 'expression entered is:' expression
say 'expression entered is:' expression
say
interpret '?='expression
say
say 'length of result='length(?)
say ' left 50 bytes of result='left(?,50)'···'
say 'right 50 bytes of result=···'right(?,50)
/*stick a fork in it, we're done.*/
say ' left 50 bytes of result='left(?,50)"···"
say 'right 50 bytes of result=···'right(?, 50) /*stick a fork in it, we're all done. */