Giter VIP home page Giter VIP logo

jgo's Introduction

Description

JGO The JGo Project aims to provide a complete compiler and runtime environment for the Go programming language to/on the Java Virtual Machine. The jgoc compiler is written in Scala and the runtime in Java.

Drone.io continuous integration service

Build Status

Gitter Chat

Gitter

Why the JVM?

The selection of the JVM was motivated by:

Compatibility & JVM debug/profiling

A lot of excellent libraries are written for the JVM. JGo hopes to make existing Go users more productive by enabling them to use these. Furthermore, many groups have large codebases written in Java, Scala, and other JVM languages. JGo is an attempt to bring these groups into the fold, group and expose them.

JGO

Status of the Project

JGo is a work in progress. Many features of the Go programming language are not yet fully supported.

Currently, these include:

  • Structs; (nearing completion)
  • Methods;
  • Packages and multi-file compilation;
  • Interfaces;
  • Lambda expressions;
  • Closures (sub-feature of lambda expressions);
  • Concurrency;
  • defer, panic, and recover; and Switch statements.

DOCS

JGO-DOCS

Contribute

Contributing to JGO

JGO welcomes contributions, feel free to play and pull requests :)

Issues

Feel free to submit issues and enhancement requests.

Contributing

Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Raise a issue on our issue tracker
  3. Commit changes to a branch in your fork using the issue, eg: git commit -m "#1"
  4. Pull request with your changes
  5. Thank you o/

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

This project contains a Ubuntu 12.04 Sandbox, a vagrant Vagrant- based Puppet development environment used for running and testing JGo with the OpenJDK 8 modules.

OpenJDK

OpenJDK JGO Uses OpenJDK 8.

Requirements

To use this, you must have the following items installed and working:

Usage

Initial Startup

To bring up the Puppet Sandbox environment, issue the following command:

vagrant up

Puppet will install Git and OpenJDK 8.

vagrant ssh

Run SBT

When the shell command for vagrant is ready run sbt

$ cd /opt/jgo/
$ sbt
Getting org.scala-sbt sbt 0.13.8 ...
[info] Set current project to jgo (in build file:/opt/jgo/)
> run hello.go package.class
[info] Updating {file:/opt/jgo/}jgo...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.

Run SBT Command

When the command line for sbt shows type run hello.go package.class This will compile and execute the following go code into the JDK8:

func say(msg string) {
	print msg
}
func main(args [4]string) {
	msg := "hello, world"
	say(msg)
	
	for i := 0; i < 10; i++ {
		print i
	}
}

Output:

> run hello.go package.class
[info] Updating {file:/opt/jgo/}jgo...
(...)
[info] Compiling 132 Scala sources and 17 Java sources to /opt/jgo/target/scala-2.10/classes...
(...)
[info] Running jgo.tools.compiler.Main hello.go package.class
LoadVar <msg: string>
PrintString
Decl <msg: string>
PushStr "hello, world"
StoreVar <msg: string>
LoadVar <msg: string>
InvokeFunction Function(say, func(string))
Decl <i: int>
PushInt 0, I32
StoreVar <i: int>
goto:  [cond of for 5]
Lbl top of for 5
LoadVar <i: int>
PrintNumeric I32
Lbl continue 5
Incr <i: int>, 1, I32
Lbl cond of for 5
LoadVar <i: int>
PushInt 10, I32
if < I32:  [top of for 5]
Lbl break 5
Undecl <i: int>
Undecl <msg: string>

License

GNU 3

GNU General Public License, version 3.

Project migrated from https://code.google.com/p/jgo/ by Harrison Klaperman.

jgo's People

Contributors

illegalargument avatar klaperman avatar thomasmodeneis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jgo's Issues

sbt build fails on jdk1.8.0_31

$ sbt
Getting org.scala-tools.sbt sbt_2.7.7 0.7.7 ...
downloading http://databinder.net/repo/org.scala-tools.sbt/sbt_2.7.7/0.7.7/jars/sbt_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#sbt_2.7.7;0.7.7!sbt_2.7.7.jar (3038ms)
downloading https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar ...
    [SUCCESSFUL ] org.apache.ivy#ivy;2.2.0!ivy.jar (1740ms)
downloading https://repo1.maven.org/maven2/com/jcraft/jsch/0.1.31/jsch-0.1.31.jar ...
    [SUCCESSFUL ] com.jcraft#jsch;0.1.31!jsch.jar (669ms)
downloading https://repo1.maven.org/maven2/org/scala-tools/testing/test-interface/0.5/test-interface-0.5.jar ...
    [SUCCESSFUL ] org.scala-tools.testing#test-interface;0.5!test-interface.jar (555ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/launcher-interface/0.7.7/jars/launcher-interface.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#launcher-interface;0.7.7!launcher-interface.jar (643ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/compile_2.7.7/0.7.7/jars/compile_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#compile_2.7.7;0.7.7!compile_2.7.7.jar (967ms)
downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.7.7/scala-library-2.7.7.jar ...
    [SUCCESSFUL ] org.scala-lang#scala-library;2.7.7!scala-library.jar (2426ms)
downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.7.7/scala-compiler-2.7.7.jar ...
    [SUCCESSFUL ] org.scala-lang#scala-compiler;2.7.7!scala-compiler.jar (3631ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/interface/0.7.7/jars/interface.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#interface;0.7.7!interface.jar (791ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/ivy_2.7.7/0.7.7/jars/ivy_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#ivy_2.7.7;0.7.7!ivy_2.7.7.jar (908ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/io_2.7.7/0.7.7/jars/io_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#io_2.7.7;0.7.7!io_2.7.7.jar (658ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/classpath_2.7.7/0.7.7/jars/classpath_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#classpath_2.7.7;0.7.7!classpath_2.7.7.jar (509ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/compiler-interface/0.7.7/jars/compiler-interface-bin.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#compiler-interface;0.7.7!compiler-interface-bin.jar (526ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/compiler-interface/0.7.7/jars/compiler-interface-src.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#compiler-interface;0.7.7!compiler-interface-src.jar (527ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/control_2.7.7/0.7.7/jars/control_2.7.7.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#control_2.7.7;0.7.7!control_2.7.7.jar (511ms)
downloading https://repo1.maven.org/maven2/jline/jline/0.9.94/jline-0.9.94.jar ...
    [SUCCESSFUL ] jline#jline;0.9.94!jline.jar (587ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/precompiled-2.8.1_2.8.1/0.7.7/jars/compiler-interface-bin.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2.8.1_2.8.1;0.7.7!compiler-interface-bin.jar (651ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/precompiled-2.9.0_2.9.0/0.7.7/jars/compiler-interface-bin.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2.9.0_2.9.0;0.7.7!compiler-interface-bin.jar (526ms)
downloading http://databinder.net/repo/org.scala-tools.sbt/precompiled-2.8.0_2.8.0/0.7.7/jars/compiler-interface-bin.jar ...
    [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2.8.0_2.8.0;0.7.7!compiler-interface-bin.jar (524ms)
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    17 artifacts copied, 0 already retrieved (4379kB/87ms)
Getting Scala 2.7.7 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    2 artifacts copied, 0 already retrieved (9911kB/35ms)
[info] Recompiling plugin definition...
[info]    Source analysis: 1 new/modified, 0 indirectly invalidated, 0 removed.
[error] error while loading Consumer, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/rt.jar(java/util/function/Consumer.class)' is broken
[error] (bad constant pool tag 18 at byte 15)
[error] one error found
Compilation failed

Wanting to try out jgo

Hi,

I just checked out the sources. What are the steps to compile the project and 
try it out? I could find no README or INSTALL file and no documentation or wiki.

What steps will reproduce the problem?
1. Check out the source with hg clone
2. ?

What version of the product are you using? On what operating system?

I'm on 64-bit Arch Linux, with scala, java and go compilers at the ready.

Original issue reported on code.google.com by [email protected] on 17 Jun 2011 at 11:28

REPL based on JSR223 in built jar

What feature would you like implemented in JGo?

It would be nice if JGo runs like an interpreter language such as 
Rhino,JRuby,Jacl,Jython,JScheme,Jawk,Beanshell...
And I would prefer that JGo is in one jar.
eg.
>java -jar jgo.jar jgo.tools.Console.Main hello.go
"Hello JGo !"



What are the potential benefits of the proposed feature?

If it would be based on JSR223 maybe it could work on Android(Dalvik JVM). I 
have ported some languages to SL4A.



Are there any possible drawbacks?

I don't know about "Go" much. But that's my problem.



Further comments or suggestions:

Improve something that doesn't exist is very hard so I
respect this project and the owner !
I am looking forward of JGo's future.

Original issue reported on code.google.com by tomcatalbino on 5 Jun 2012 at 4:43

Oh god please no

It is unbelievable, this arrogance of the Java programmers, that they always have this urge to port every programming language to their holy sacred GayVM.

A lot of excellent libraries are written for the JVM. JGo hopes to make existing Go users more productive by enabling them to use these.

You didn't understand anything about the philosophy of Go. We Go programmers made the conscious choice to MOVE AWAY from that bloated crap like Java or C++. We are NOT more productive by using Java libraries. Get yourself acquainted with the principles of Go first before you indulge blindly to your urge that everything on this earth needs to be ported to JVM, no matter what its philosophy was in the first place.

Further reading:
https://golang.org/doc/faq#What_is_the_purpose_of_the_project
https://plus.google.com/101960720994009339267/posts/hoJdanihKwb

We really don't need another Java port of $Programminglanguage. We want to code in Go and hope that this industrial enterprise software crap like Java is going to die really really soon.

fix warnings


[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/parser/combinatorExten/ExceptionTracing.scala:15: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
[warn]       case e =>
[warn]            ^
[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/transl/func/FuncTranslBase.scala:107: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
[warn]         case e => e.printStackTrace(); throw AtInstrException(i, e)
[warn]              ^
[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/transl/TypeResolution.scala:64: match may not be exhaustive.
[warn] It would fail on the following inputs: C128, C64
[warn]   def toAsmType(t: StackType): AsmType = t match {
[warn]                                          ^
[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/transl/TypeResolution.scala:106: match may not be exhaustive.
[warn] It would fail on the following inputs: C128, C64
[warn]   def typeDesc(t: StackType): String = t match {
[warn]                                        ^
[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/transl/func/LabelsAndJumps.scala:51: match may not be exhaustive.
[warn] It would fail on the following inputs: ObjEq, ObjNe
[warn]     case Branch(test, l) => test match {
[warn]                             ^
[warn] /opt/gocode/src/jgo/jgo/src/main/scala/jgo/tools/compiler/transl/func/LabelsAndJumps.scala:65: match may not be exhaustive.
[warn] It would fail on the following inputs: ObjEq, ObjNe
[warn]     case BranchNot(test, l) => test match {
[warn]                                ^
[warn] there were 86 deprecation warning(s); re-run with -deprecation for details
[warn] there were 57 feature warning(s); re-run with -feature for details
[warn] 8 warnings found
[info] /opt/gocode/src/jgo/jgo/src/main/java/jgo/runtime/ObjSlice.java: Some input files use unchecked or unsafe operations.
[info] /opt/gocode/src/jgo/jgo/src/main/java/jgo/runtime/ObjSlice.java: Recompile with -Xlint:unchecked for details.
[info] Running jgo.tools.compiler.Main hello.go package.class
[info] Compiling 7 Scala sources to /opt/jgo/target/scala-2.10/test-classes...
[warn] /opt/jgo/src/test/scala/BlockTest.scala:375: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
[warn]       case e =>
[warn]            ^
[warn] /opt/jgo/src/test/scala/ParserTest.scala:38: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
[warn]       case e =>
[warn]            ^
[warn] two warnings found
[warn] there were 66 deprecation warning(s); re-run with -deprecation for details
[warn] there were 57 feature warning(s); re-run with -feature for details

test LexTestAll failing

[info] Running LexTestAll 
[error] (run-main-1) java.lang.NullPointerException
java.lang.NullPointerException
    at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:114)
    at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:114)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:32)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
    at LexTestAll$.testAll(LexTestAll.scala:19)
    at LexTestAll$.main(LexTestAll.scala:13)
    at LexTestAll.main(LexTestAll.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
[trace] Stack trace suppressed: run last test:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last test:run for the full output.
[error] (test:run) Nonzero exit code: 1
[error] Total time: 27 s, completed May 31, 2015 12:34:09 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.