Name: goby
Owner: goby-lang
Description: Goby - A new language helps you develop microservices
Created: 2017-02-08 09:23:33.0
Updated: 2018-01-19 12:15:46.0
Pushed: 2018-01-20 20:18:51.0
Homepage: http://goby-lang.org
Size: 4767
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Goby is an object-oriented interpreter language deeply inspired by Ruby as well as its core implementation by 100% pure Go. Moreover, it has standard libraries to provide several features such as the Plugin system. Note that we do not intend to reproduce whole of the honorable works of Ruby syntax/implementation/libraries.
One of our goal is to provide web developers a sort of small and handy environment that mainly focusing on creating API servers or microservices. For this, Goby includes the following native features:
Note: Goby had formerly been known as “Rooby”, which was renamed in May 2017.
New! Check-out our sample app built with Goby. Source code is also available here.
Goby has several aspects: language specification, design of compiler and vm, implementation (just one for now), library, and the whole of them.
Language: Class-based, straight-ahead object-oriented script language. Syntax is influenced by Ruby language (and by Go a bit), but has been condensed and simplified (and slightly modified) to keep Goby VM simple and concise. Several aspects of Ruby such as meta-programming (known as 'magic'), special variables with $
, have been dropped for now, but note that we might resurrect some of them with a different form or implementation in the future.
Class: Single inheritance. Module is supported for mixin with #include
or #extend
. Defining singleton class and singleton method are also supported. Goby has two kinds of class internally: native class and standard class. Native class (or builtin class) provides fundamental classes such as Array
or String
. Object
class is a superclass of any other native/standard classes including Class
class. Class
class contains most common methods such as #puts
. Standard class (or standard library) can be loaded via require
and provides additional methods. Standard classes are often split internal Go code and external Goby code in order to make implementation easier. Both kinds of class are transparent to Goby developers and can be overridden by child classes. Any classes including Class
class are under Object
class.
Compiler: Consists of AST, lexer, parser, and token, which of the structure is pretty conventional and should be familiar to language creators. These components are all written in 100% pure Go, instead of using conventional static yacc/lex/bison conversion with a mess of ad-hoc macros. This makes Goby's codes far smaller, concise, and legible. You can inspect, maintain, or improve Goby codes more easily, being free from pains like C/C++ era.
VM: YARV-conscious, including stack and call_frame, as well as containing Goby's native classes and some standard library and additional components. All are written in Go as well.
Implementation: Built-in monolithic Go binary executable which equips several native features such as a robust thread/channel mechanism powered by goroutine, a very new experimental Plugin system to manage existing Go packages dynamically from Goby codes, igb (REPL) powered by readline package. Goby contains some standard or third-party Go packages, but the dependency to them is not high. These packages contain no CGO codes (at least by now) thus cross-compile for any OS environments that Go supports should work fine.
Library: Provides some lean but sufficient standard libraries to support developers, including threaded high-performance HTTP server, DB adapter, file or JSON. Curiously, most of them are split into Go and Goby codes, and Goby codes are not within Goby executable but placed under lib directory as Goby script files. Of course you can create custom libraries and include them to your codes. Thanks to the flexibility of Plugin system, we expect that you can quickly import most of the existing Go packages to your Goby scripts without creating additional libraries from scratch in almost all cases.
Let's improve Goby together!: We are optimizing and expanding Goby all the time. Toward the first release, we've been focusing on implementing Goby first.
goby -i
)Perhaps Goby should be far easier for Rubyists to comprehend. You can use Ruby's syntax highlighting for Goby as well?
<
#send
new!self
#include
for instance methods#extend
for class methods::
for delimiting namespacesvar
Var
or VAR
$
are unsupported)a
, b
)ary=[]
, hs={}
)*sp
) for compatibility with Go functionsdo
- end
if
, else
, elsif
while
raise
100
, -299
, -0
3.14
, -273.15
"candy"
, 'cake'
, :taffy
:email
String
class and just a convenient representation for Rubyists.a = :bar.replace("a", "z"); puts a #=> bzr
[1, "2", '3', :att]
{ "email": 'goby@goby-lang.com', tel: '9909-999-999'}
#puts
ARGV
, STDIN
, STDOUT
, STDERR
, ENV
constantsrequire
(Just for standard libraries by now)require_relative
thread
method to create a new threadChannel
class for passing objects between threads, like chan
in Godef
, true
, false
, nil
, if
, elsif
, else
, case
, when
, return
, self
, end
, while
, do
, yield
, next
, class
, module
, break
thread
or raise
Written in Go.
Class
Integer
String
:a
or hash keys {a: 1}
are just another notation of String
Boolean
Null
(nil
)Hash
Array
Range
URI
Channel
File
GoObject
(provides #go_func
that wraps pure Go objects or pointers for interaction)Regexp
and MatchData
MatchData
(to hold the result of regexp matching)Float
Decimal
a = "-99.99999999".to_d
written in Go and Goby.
Concurrent::Array
Concurrent::Hash
DB
(only for PostgreSQL by now)Plugin
JSON
Net::HTTP
Net::HTTP::Client
Net::HTTP::Request
Net::HTTP::Response
Net::SimpleServer
(try sample Goby app and source, or sample code!)rescue
, begin
– by 2018 Marchrubygem
)Confirmed Goby runs on Mac OS and Linux for now. Try Goby on Windows and let us know the result.
Note: Please check the latest release before installing Goby via Homebrew
tap goby-lang/goby
install goby
In the case, $GOBY_ROOT
is automatically configured.
Try this if you'd like to contribute Goby! Skip 1 if you already have Golang in your environment.
$GOPATH
in your shell's config file( like .bashrc) is correct$GOPATH/bin
to $PATH
go get github.com/goby-lang/goby
$GOBY_ROOT
manually, which should be:ATH/src/github.com/goby-lang/goby
In order to install Go, Goby and PostgreSQL on a Linux system, see the wiki page.
goby -v
to see the version.goby -i
to launch igb REPL.require "uri"
in igb.FYI: You can just run brew test goby
to check Homebrew installation.
If you have any issue installing Goby, please let us know via Github issues
Goby has official docker image as well. You can try the Plugin System using docker.
Goby
's simple server is very performant and can handle requests concurrently)More sample Goby codes can be found in sample directory.
See the guideline.
Support us with a monthly donation and help us continue our activities. [Become a backer]
Supporting Goby by sending your first PR! See contribution guideline
Or support us on opencollective
The followings are the essential resources to create Goby; I highly recommend you to check them first if you'd be interested in building your own languages: