Giter Site home page Giter Site logo

goscript's Introduction

Goscript

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

The Goal

  • Runs most pure Go code, probably add some dynamic features if requested.

How do I try

The project "engine" is the entry/wrapper. there are test cases in here to browse through.

  • Make sure your Rust installation is up to date.
  • Clone this repository.
  • Go to goscript/engine
  • Run cargo test -- --nocapture

Use Cases

  • As an embedded language like Lua.
  • As a glue language like Python.

Rationale

  • A scripting language that can be embedded in Rust.
  • Go is popular and easy(even as a scripting language), why invent new grammars?
  • In some cases, when your project gets big:
    • If Go were an embedded language it would be better than Lua.
    • If Go were a glue language it would be better than Python, in terms of project maintainability.
  • I found a new hammer(Rust) that I like, and decided to use it on a nail(Go) that I like.

Implementation

  • There are five projects:
    • parser -- a port of the official implementation that comes with the Go installer.
    • type checker -- a port of the official implementation that comes with the Go installer.
    • codegen -- generates the bytecode.
    • vm -- runs the bytecode.
    • engine -- the wrapper.

Progress

  • Language: Feature complete (except the features that are so insignificant that I forgot -_-) Some of the features are, probably for the first time, implemented in a script language, like Select/Defer/Pointer/Interface/Struct.
  • Standard library: just got started.
  • Production readiness: far from. The parser and the type checker are probably ok because they were ported and passes the test cases comes with the original code. The backend has a lot of rough edges, and we need much more test cases.
  • Next step: no new features for now, polish then work on the standard library.

Get in touch

goscript's People

Contributors

cryze avatar makotoe avatar nnbnh avatar oxfeeefeee avatar

Watchers

 avatar  avatar

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.