@gandib/g
v1.0.5
Published
An interpreted custom programming language built with TypeScript.
Readme
# 🚀 G Language
<p align="center">
<img src="https://raw.githubusercontent.com/github/explore/main/topics/typescript/typescript.png" width="120" />
</p>
<p align="center">
<b>A modern compiled programming language built with TypeScript</b>
</p>
<p align="center">
⚡ Bytecode VM • 🧠 Compiler • 🔍 LSP • 🎨 VS Code Extension
</p>
---
# ✨ Features
- ⚡ Compiled to Bytecode
- 🧠 Custom Virtual Machine (VM)
- 🔍 Full Lexer + Parser + AST
- 🚀 Fast Runtime
- 🎨 VS Code Syntax Highlighting
- 🧩 Language Server Protocol (LSP)
- 💡 IntelliSense & Hover Support
- 🔁 Functions & Loops
- 📦 CLI Runtime
- 🛠 Built with TypeScript
---
# 📦 Installation
## Install globally
```bash
npm install -g @gandib/gVerify installation:
g --version🚀 Quick Start
Create a file:
hello.gExample:
let x = 10
show x + 5
func hello
show "Hello from G Language"
end
call hello
repeat 3
show "Loop running"
end
func add a b
show a + b
end
call add 5 10Run the program:
g run hello.gOutput:
15
Hello from G Language
Loop running
Loop running
Loop running
15🖥 REPL Mode
Start interactive mode:
gExample:
Welcome to G Language REPL
g > let x = 10
g > show x
10Exit REPL:
exit📚 Language Syntax
Variables
let name = "G Language"
let age = 10Output
show "Hello World"
show ageMath
let x = 10
show x + 20Functions
func greet
show "Hello"
end
call greetFunction Arguments
func add a b
show a + b
end
call add 5 10Loops
repeat 5
show "Loop"
end🧠 VS Code Extension
Install the official VS Code extension from the Marketplace.
Search for:
G LanguageFeatures:
- 🎨 Syntax Highlighting
- 💡 IntelliSense
- 🔍 Hover Information
- ❌ Error Diagnostics
- ⚡ Autocomplete
- 🧠 Compiler Integration
🏗 Compiler Architecture
Source Code (.g)
↓
Lexer
↓
Parser
↓
AST
↓
Compiler
↓
Bytecode
↓
Virtual Machine
↓
Output📁 Project Structure
g-language/
│
├── src/
│ ├── lexer.ts
│ ├── parser.ts
│ ├── ast.ts
│ ├── compiler.ts
│ ├── bytecode.ts
│ ├── vm.ts
│ └── interpreter.ts
│
├── bin/
│ └── g.ts
│
├── vscode-extension/
│ ├── client/
│ ├── server/
│ └── syntaxes/
│
├── examples/
│ └── hello.g
│
└── package.json⚙️ Build From Source
Clone repository:
git clone https://github.com/gandib/g
cd gInstall dependencies:
npm installCompile TypeScript:
npx tscRun locally:
node dist/bin/g.js run hello.g🧪 Example Programs
Hello World
show "Hello World"Calculator
func add a b
show a + b
end
call add 20 30Loop Example
repeat 5
show "Running..."
end🛣 Roadmap
- [x] Lexer
- [x] Parser
- [x] AST
- [x] Bytecode Compiler
- [x] Virtual Machine
- [x] VS Code Extension
- [x] Language Server
- [ ] Debugger
- [ ] Static Type System
- [ ] Classes
- [ ] Modules
- [ ] Imports
- [ ] Package Manager
- [ ] JIT Compiler
- [ ] Native Compilation
🤝 Contributing
Contributions are welcome.
git clone https://github.com/gandib/g
cd g
npm install📜 License
MIT License
👨💻 Author
Created by Gandib Dhari Roy
⭐ Support
If you like G Language:
⭐ Star the repository 🚀 Share the project 🧠 Build cool things with G
