#golang #goscript

go-engine

The wrapper of the Goscript project

6 releases

0.1.5 Sep 12, 2023
0.1.4 Sep 8, 2023
0.1.3 Jul 4, 2023
0.1.1 May 27, 2023
0.1.0 Apr 4, 2023

#5 in #goscript

Download history 10/week @ 2023-08-20 22/week @ 2023-08-27 34/week @ 2023-09-03 56/week @ 2023-09-10 16/week @ 2023-09-17 12/week @ 2023-09-24 12/week @ 2023-10-01 9/week @ 2023-10-08 24/week @ 2023-10-15 20/week @ 2023-10-22 19/week @ 2023-10-29 9/week @ 2023-11-05 8/week @ 2023-11-12 21/week @ 2023-11-19 34/week @ 2023-11-26 11/week @ 2023-12-03

75 downloads per month
Used in golana-cli

BSD-2-Clause

1.5MB
33K SLoC

This crate is part of the Goscript project. Please refer to https://goscript.dev for more information.

It's a wapper of all the parts of the Goscript project. It also implements the standard library, the standard library part is still under development, only a few parts are implemented.

Example:

use std::path::{Path, PathBuf};
use go_engine::{Config, ErrorList, SourceReader, run};

fn run_file(path: &str, trace: bool) -> Result<(), ErrorList> {
   let mut cfg = Config::default();
   cfg.trace_parser = trace;
   cfg.trace_checker = trace;
   let sr = SourceReader::local_fs(PathBuf::from("../std/"), PathBuf::from("./"));
   let result = run(cfg, &sr, Path::new(path), None);
   if let Err(el) = &result {
       el.sort();
       eprint!("{}", el);
   }
   result
}

Feature

The project is entended to be enbedded, so it has a lot of feature flags to turn on/off different parts.

  • read_fs: Read source code from local file system
  • read_zip: Read source code from zip file
  • async: Channel and goroutine support
  • go_std: Enable the Go standard library
  • btree_map: Make it use BTreeMap instead of HashMap
  • codegen: Enable codegen
  • instruction_pos: Add instruction position to bytecode for debugging
  • serde_borsh: Serde support for bytecode using Borsh
  • wasm: Enable wasm support

Dependencies

~1.8–4MB
~84K SLoC