Skip to content

zuluoaaa/makeJs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

makeJs

For leaning how to do a interpreter.

So I make a sub Javascript interpreter for interpreting itself. (No dependence any third-party)

In developing

Now support:

  • define variables
  • simple expression
  • compares
  • if statement
  • while loop
  • Function
  • Array

demo.jpg

function quickSort(list,len) {
    let a = 0;
    let b = len-1;
    let c = 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];
        }
    }
    return list;
}

let arr = [9,3,2,1,5,-2,6];
quickSort(arr,7);

See the test folder for more examples

Future support:

  • Object
  • ...

About

A sub Javascript interpreter for interpreting itself

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy