Skip to content

GoScript is a lightweight scripting language implemented in Go. It provides a simple, expressive syntax for common scripting tasks and serves as an excellent platform for learning language design and building domain-specific languages.

License

Notifications You must be signed in to change notification settings

BaseMax/GoScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoScript

License: MIT

GoScript is a lightweight scripting language implemented in Go. It provides a simple, expressive syntax for common scripting tasks and serves as an excellent platform for learning language design and building domain-specific languages.

Features

  • Interpreted Scripting: Write and execute scripts without a separate compilation step.
  • Simple Syntax: Clean and intuitive syntax for arithmetic, logic, conditionals, loops, functions, and more.
  • Modular Design: Easily extend or integrate new features thanks to the well-organized code structure.
  • Cross-Platform: Built in Go, GoScript can run on any platform that supports Go.

Syntax

Hello World:

print("Hey World!")

Fibonacci:

fn f(n) {
    if n <= 1 { 1 }
    n * f(n-1)
}

println(f(5))

Getting Started

Prerequisites

  • Go Tested on 1.22.4

Installation

Clone the repository:

git clone https://github.com/BaseMax/GoScript.git
cd GoScript

Build the project:

go build -o goscript
or
go build -o goscript.exe

Alternatively, you can run it directly with:

go run goscript.go

Running a Script

After building the executable, you can run a GoScript file by providing its path as an argument:

./goscript.exe path/to/your/script.gos

For example, to run one of the provided examples:

./goscript.exe examples/hello.gos

Project Structure

GoScript/
├── .gitignore           # Git ignore file
├── evaluator.go         # Evaluator: Executes the AST nodes
├── examples/            # Example GoScript programs
├── go.mod               # Go module file
├── goscript.exe         # Compiled executable (Windows)
├── lexer.go             # Lexer: Tokenizes the source code
├── LICENSE              # MIT License file
├── goscript.go          # Entry point of the interpreter
└── parser.go            # Parser: Builds the AST from tokens

Contributing

Contributions to GoScript are welcome! If you have ideas for improvements, new features, or bug fixes, please follow these steps:

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Commit your changes with clear messages.
  • Open a pull request describing your changes.
  • Feel free to open issues for any bugs or feature requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Copyright

© 2025 Max Base (Seyyed Ali Mohammadiyeh)

About

GoScript is a lightweight scripting language implemented in Go. It provides a simple, expressive syntax for common scripting tasks and serves as an excellent platform for learning language design and building domain-specific languages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy