GithubHelp home page GithubHelp logo

crossoverjie / gscript Goto Github PK

View Code? Open in Web Editor NEW
217.0 7.0 24.0 2.79 MB

💪🏻This is a statically and strongly typed language written in Go.|GScript 是用 Go 编写的静态、强类型的脚本语言。

Home Page: https://gscript.crossoverjie.top/

License: BSD 3-Clause "New" or "Revised" License

Go 91.83% Makefile 0.49% ANTLR 3.08% JavaScript 4.29% GLSL 0.19% Dockerfile 0.12%
antlr4 compile golang go language programming-language

gscript's Issues

类型系统

建议实现自己的类型系统,以后扩展和维护都能轻松不少

增加语义分析/类型检查

gscript在定位上是一门强类型的语言,然而以下代码却能正常编译并运行

int getNumber(){
  return true;  // 返回值应该是一个整型而不是布尔
}
println(getNumber());

这显然是与gscript强类型的定位相悖的
所以是否有必要在语法解析和解释之间增加一个类型检查(语义分析)的步骤?

undefined: while

string S = "abcdefx";
string T = "def";
int myIndex(string S,string T,int pos) {
  int i = pos;
  int j = 0;
  byte[] s = toByteArray(S);
  byte[] t = toByteArray(T);

  int slen = len(s);
  int tlen = len(t);
  while(i <= slen && j <= tlen) { //undefined: while
  // for(i <= slen && j <= tlen) {
    if (s[i] == s[j]) {
      i += 1;
      j += 1;
    }else{
      i = i - j + 1;
      j = 0;
    }
  }
  if (j == tlen) {
    return i - tlen;
  } else {
    return 0;
  }
}

int res = myIndex(S,T,0);
println(res);

[编译错误]`make build` 时报错, 提示`go-bindata` 错误

老师你好, 我在下载了 0.0.8 源码准备按照您的建议自行 make build 时发生了以下错误, 是我哪里操作有问题吗?

# 项目根目录运行 make build
$> make build
make bindata
go-bindata -pkg internal -o internal/internal.go internal/
make[1]: go-bindata: No such file or directory
make[1]: *** [bindata] Error 1
make: *** [build] Error 2

[请教]有没有 `printf`?

老师你好, 我在 oschina 上看到 GScript 的介绍, 很喜欢这个语言, 再尝试使用, 我有使用到 println 这个函数. 但是我希望可以使用 printf 这样的函数, 不知道咱们 GScript 有没有? 我尝试检索项目查找, 但是没有找到定义. 求老师告知一下.

谢谢

另外, 我想看一下 gscript --help 说明, 结果看到了如下错误:

$> gscript --help
panic: read script fail, err:open --help: no such file or directory

goroutine 1 [running]:
main.main()
	/Users/chenjie/Documents/dev/github/compile/gscript/cmd/gscript.go:18 +0xb9

我是直接下载 executable 版本的, 这样的错误, 是不是老师您建议我下载源码自行编译?

[教程语法错误]

func int() fun(){
    int a = 0;
    int b = 1;
    int fibonacci(){
        int c = a;
        a = b;
        b = a+c;
        return c;
    }
    return fibonacci;
}

func int() f = fib();

for (int i = 0; i < 10; i++){
    println(f());
}

感觉这里第一行定义疑似应该是 func int() fib() { ... }.

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.