-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Pranav M S edited this page May 17, 2025
·
1 revision
Flux is a simple, interpreted programming language implemented in Go. It features a clean syntax and supports basic programming constructs like functions, conditionals, and string operations. The language is designed to be easy to learn and use while providing essential programming features.
- Go 1.23.2 or higher
- Git
-
Clone the repository:
git clone https://github.com/pranavms13/flux-lang.git cd flux-lang -
Build the project:
go build -o dist/flux
To run a Flux program:
./dist/flux run <filename>To compile a Flux program to a binary:
./dist/flux compile <filename>Flux supports the following basic features:
- Variable declarations using
let - Function definitions using
fn - Conditional expressions using
if-then-else - String concatenation using
+ - Basic arithmetic operations
- Print statements for output
- Lists and Dictionaries
- Numbers (integers)
- Strings
- Lists
- Dictionaries
- Functions
- If-else statements
- Function calls
- Basic arithmetic expressions
-
lexer/: Tokenizes source code into tokens -
parser/: Parses tokens into an Abstract Syntax Tree (AST) -
compiler/: Compiles AST into bytecode -
vm/: Virtual machine that executes bytecode -
types/: Core type definitions -
runtime/: Runtime functionality and built-in functions -
vsce/: VS Code Extension for Flux Language
- github.com/alecthomas/participle/v2 - For parsing
- Install Go 1.23.2 or higher
- Clone the repository
- Install dependencies:
go mod download
go build -o dist/fluxgo test ./...-
Install the dependencies:
npm install -g yo generator-code
-
Build the extension:
cd vsce vsce package -
Install the VSIX file in VS Code:
- Open VS Code
- Press Ctrl+Shift+P
- Select "Extensions: Install from VSIX..."
- Choose the generated .vsix file
- Reload VS Code if prompted
- Syntax highlighting for
.fluxfiles - Basic language support
- Code snippets
- Bracket matching
- Comment toggling
print("Functions")
let double = fn(x) => x + x
let result = double(5)
print(result)
print("Add Strings")
let name = "Flux"
print("Hello, " + name)
let x = 5
let msg = if x > 0 then {
print("x is positive")
"yes"
} else {
"no"
}
print(msg)
Contributions are welcome! Please refer to CONTRIBUTING.md for guidelines on how to contribute to the project.
This project is licensed under the MIT License - see the LICENSE file for details.
- Author: Pranav M S
- GitHub: @pranavms13
- Email: flux@pranavms.dev