For leaning how to do a interpreter.
So I make a sub Javascript interpreter for interpreting itself. (No dependence any third-party)
Now support:
- define variables
- simple expression
- compares
- if statement
- while loop
- Function
- Array
functionquickSort(list,len){leta=0;letb=len-1;letc=list[a];while(a<b){while(list[b]>c&&a<b){b=b-1;}if(list[b]<c){list[a]=list[b];list[b]=c;b=b-1;c=list[b];}while(list[a]<c&&a<b){a=a+1;}if(list[a]>c){list[b]=list[a];list[a]=c;a=a+1;c=list[a];}}returnlist;}letarr=[9,3,2,1,5,-2,6];quickSort(arr,7);See the test folder for more examples
- Object
- ...
