A high-level scripting language with intuitive syntax that seamlessly integrates with Go's ecosystem.
- High-level syntax: Clean, readable code that's easy to write and maintain
- Seamless Go integration: Import and use any Go module or package
- Native Go packaging: Full compatibility with Go's module system
- Custom packaging: Enhanced import system for .gos to .gos dependencies
- Easy functions: Simplified function definitions and calls
- Minimal code: Express complex logic with fewer lines
- Professional codebase: Production-ready architecture and tooling
go install github.com/GrandpaEJ/go-script/cmd/gos@latestCreate a file hello.gos:
func main():
print("Hello, World!")
Run it:
gos run hello.gos# Variables with type inference
name := "Go-Script"
count := 42
active := true
# Explicit typing
var message string = "Hello"
var numbers []int = [1, 2, 3, 4, 5]
# Simple function
func greet(name string) string:
return "Hello, " + name
# Function with multiple returns
func divide(a, b float64) (float64, error):
if b == 0:
return 0, error("division by zero")
return a / b, nil
# If statements
if age >= 18:
print("Adult")
elif age >= 13:
print("Teenager")
else:
print("Child")
# For loops
for i in range(10):
print(i)
for key, value in items:
print(key, ":", value)
# Import Go packages
import "fmt"
import "net/http"
import "encoding/json"
# Use Go functions directly
func main():
resp, err := http.Get("https://api.github.com")
if err != nil:
fmt.Println("Error:", err)
return
defer resp.Body.Close()
fmt.Println("Status:", resp.Status)
# Define structs
struct Person:
name string
age int
func greet(self) string:
return "Hi, I'm " + self.name
# Create and use
person := Person{name: "Alice", age: 30}
print(person.greet())
go-script/
├── cmd/gos/ # CLI tool
├── pkg/
│ ├── lexer/ # Lexical analysis
│ ├── parser/ # Syntax analysis
│ ├── ast/ # Abstract Syntax Tree
│ ├── codegen/ # Go code generation
│ ├── runtime/ # Runtime support
│ └── stdlib/ # Standard library
├── examples/ # Example programs
├── docs/ # Documentation
└── tests/ # Test suite
This project is under active development. Core features are being implemented in phases:
- ✅ Project setup and architecture
- 🔄 Lexer and parser implementation
- ⏳ Code generation and Go integration
- ⏳ Runtime and standard library
- ⏳ CLI tools and build system
- ⏳ Testing and documentation
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.