Skip to content

ktoso/jo

Repository files navigation

Jo - The JVM based Go implementation

This is a pet project.

And it should be spelled as "Joe", that is - similiar to "Go" the original language we're reimplementing here.

See the official language page and docs here: golang.org

Does this even work?

Somewhat, but it'll get better in time.

For now we're able to support Println and returning a string from a func... ;-)

Examples

Go code using Jo is aimed to be used both, dynamically as you can see here:

it should "return a string from a func" in {
  // given
  val text = "Hello, 世界"
  val source =
    s"""package helloworld2
       |
       |func GetHello() string {
       |    return "$text"
       |}
    """.stripMargin

  // when
  val app = JoApp.fromString(source)
  val result = app.callUnsafe("GetHello", classOf[String])

  // then
  info("Jo func [GetHello] returned: " + result) // Hello, 世界

  result should equal (text)
}

as well as to compile into a fat-jar. But that's pretty much light years away... ;-)

What's inside?

  • The JVM
  • Scala as primary impl language
  • ANTLR4 as parser generator
  • ASM as bytecode generator

Other Go impls on the JVM

You may want to try out: https://code.google.com/p/jgo (funny - he selected the same impl stack :-)).

Disclaimer

This is a pet project in order for me to have fun generating bytecode and parsers - I'm fully aware of why/how/when the JVM vs. Go's runtime offer pretty different things.

About

Jo - The JVM based Go implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages