Code: Select all
var s = "\"Hello World\"";
print( s );
s = "Hello \n World";
print( s );
Code: Select all
var s = "\"Hello World\"";
print( s );
s = "Hello \n World";
print( s );
Code: Select all
var a = 88
var b = 99
var c = a + b
Code: Select all
var b 44;
print(b);
Code: Select all
var 44;
print(b);
print(c);
print(h);
var c = 99;
print(c);
First the error message (related to line 1) and then execution continues regardless of the error.Illegal Function Call Number
b
c
h
99
0.01092517290982586
Code: Select all
var b 44;
print(b);
Code: Select all
var b 44+44;
print(b);
Code: Select all
var 44;
I agree. That can be fixed. I am somewhat concerned with speed too. Most examples execute at about .001/second - 00.5. I've been writing and testing my code on a crappy AMD A4 Quad Core. It's slow, in fact, it's slower and crappier than 90% of the computers that are out on the market now. But to see your code perform under the worst possible conditions is to see it truly perform. Still I'd like to get that Execution time down a bit.The line that contains an error does not get executed but the line that relies upon correct execution of the
erroneous line does. That's not good.
Code: Select all
? curLine.tostring : sleep
Code: Select all
var arr = [1,2,3,4,5];
var x = fix( rnd*arr.length );
print( x );
Code: Select all
var arr = [1,2,3,4,5];
var idx = rnd*arr.length;
print( arr[ fix(idx) ] );
Code: Select all
Function InStr_Naive ( byref strbig As String, byref strlittle As String ) As Integer
Dim As Integer ll = Len(strlittle)-1, lb = Len(strbig)-1
Dim As Integer OK = 0
For i As Integer = 0 To lb
If strbig[i] = strlittle[0] Then
If strbig[i+ll] = strlittle[ll] Then
OK = i+1
For ii As Integer = i To i+ll
If strbig[ii] <> strlittle[ ii - i ] Then OK = 0:Exit For
Next
Else
i+=ll
Endif
Endif
If OK Then Return OK
Next
Return OK
End Function
dim as string all_func_names = ",var,function,print,sqr,+,/,*,^,%," _
+ "sin,cos,tan,asin,acos,atan,atan2,sqr,abs," _
+ "log,fix,int,frac,sgn,rnd,mod," _
+ "len,asc,chr,left,right,mid,lcase,ucase,instr," _
+ "pluck,load_file_as_string,beep," _
+ "length,pop,push,sleep,push_back,last,first," _
+ "size,split,slice,typeof,clear,cls," _
+ ""
dim as double tnow
dim as integer idx
tnow = timer
for i as integer = 0 to 100000
idx = instr_naive( all_func_names, ",cls," )
next i
? timer - tnow
? idx
sleep
tnow = timer
for i as integer = 0 to 100000
idx = instr( all_func_names, ",cls," )
next i
? timer - tnow
? idx
sleep
Code: Select all
case asc("+"), asc("/"), asc("*"), asc("%"), asc("^")
check_quotes()
if check1 <> "" then
var_or_func(tokens)
endif
addToken(_MATHOP_,ascii(s[i]),tokens)
case 9, 10, 13, 32
check_quotes()
Code: Select all
case asc("+"), asc("/"), asc("*"), asc("%"), asc("^")
Code: Select all
case 9, 10, 13, 32
check_quotes()
Code: Select all
case asc(!"\t"), asc(!"\n"),asc(!"\r"),asc(!"\"")
check_quotes()
Code: Select all
case 34
if inQuotes = 0 then inQuotes = 1 else inQuotes = 0
Code: Select all
case asc(!"\"")
if inQuotes = 0 then inQuotes = 1 else inQuotes = 0
Code: Select all
while (1) ;
Code: Select all
while (1) {;};
Code: Select all
number ::= int
number ::= int frac
number ::= int exp
number ::= int frac exp
int ::= digit
int ::= digit1-9 digits
int ::= - digit
int ::= - digit1-9 digits
frac ::= . digits
exp ::= e digits
exp ::= digits
exp ::= digit
exp ::= digit digits
e ::= e
e ::= e+
e ::= e-
e ::= E
e ::= E+
e ::= E-
Code: Select all
var s = "hello world";
var a = [sin(55),len(s),s];
Code: Select all
var s = "hello";
var t = "world";
var a = {s:t};
Yeah, that was just lazy coding. I will fix that.Why not use asc for the values at the second case label as well
Code: Select all
var a = [];
var s = "hello world";
array.push_back( sin(55) );
array.push_back( len(s) );
array.push_back( s );
Code: Select all
var s = "hello";
var t = "world";
var a = {s:t};