Skip to content

Kori-Sama/kori-compiler-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a compiler for my own language

Target code is JavaScript, so it needs node environment to run the compiled code

Example

func main() {
    let ans = fact(5);
    println(ans);
}

func fact(num) {
    if num < 1 {
        return 1;
    }

    return fact(num-1) * num;
}

Keyword

  • func: declare a function
  • let: declare a immutable variable
  • var: declare a mutable variable
  • return: return value of function
  • if: if statement
  • for: for loop
  • println: convert to console.log in js directly

Tips

  • The entry of this language is main function
  • Every expression should be end with a semicolon

About

A compiler for my own language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published