Metadata-Version: 2.4
Name: nexa-primekhatab
Version: 0.2.0
Summary: Nexa programming language - Write once, run anywhere
Home-page: https://github.com/aliclan786k-pixel/nexa
Author: Primekhatab
Author-email: Primekhatab <mohdkhatab@outlook.com>
License: MIT
Project-URL: Homepage, https://github.com/aliclan786k-pixel/nexa
Project-URL: Repository, https://github.com/aliclan786k-pixel/nexa
Project-URL: Issues, https://github.com/aliclan786k-pixel/nexa/issues
Keywords: nexa,programming-language,compiler,interpreter
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Compilers
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# nexa-primekhatab

A small, fast, expressive programming language. **Write once, run anywhere**.

## Install

```bash
pip install nexa-primekhatab
```

## Quick Start

```bash
# Check version
nexa --version

# Run a Nexa program
nexa run examples/hello.nx

# Create your own file
echo 'fn main() { print("Hello from Nexa!"); }' > hello.nx
nexa run hello.nx

# Compile to native binary
nexa build hello.nx -o hello
./hello
```

## Commands

| Command | Description |
|---------|-------------|
| `nexa run file.nx` | Interpret and run code |
| `nexa build file.nx` | Compile to native binary |
| `nexa build file.nx -o app` | Compile with custom output name |
| `nexa fmt file.nx` | Format code |
| `nexa parse file.nx` | Print AST |
| `nexa dbg file.nx` | Interactive debugger |
| `nexa new myproject` | Create new package |
| `nexa add somelib` | Add dependency |
| `nexa install` | Install dependencies |

## Language Syntax

### Variables
```nexa
let x = 10;              // immutable
let mut y = 20;          // mutable
y = 30;                  // OK - mutable
```

### Functions
```nexa
fn add(a: i32, b: i32) -> i32 {
    return a + b;
}

// Single expression (implicit return)
fn double(x: i32) -> i32 { x * 2 }
```

### Control Flow
```nexa
// If/else
if x > 0 {
    print("positive");
} else {
    print("negative");
}

// While loop
while i < 10 {
    print(i);
    i = i + 1;
}

// For loop
for i in 0..10 {
    print(i);
}

// Pattern matching
match value {
    0 => "zero",
    1..=9 => "small",
    _ => "large",
}
```

### Types
```nexa
let a: i32 = 100;        // Integer
let pi: f64 = 3.14;      // Float
let flag: bool = true;    // Boolean
let name: string = "Nexa"; // String
let arr = [1, 2, 3];      // Array
let person = (1, "Alice"); // Tuple
```

### Built-in Functions
```nexa
print("Hello!");           // Print output
len([1, 2, 3]);           // Array length
to_string(42);             // Convert to string
push([1, 2], 3);           // Add to array
typeof(42);                // Get type name
abs(-5);                   // Absolute value
str_to_upper("hello");     // "HELLO"
str_contains("hello", "ell"); // true
```

### FFI (Call C Functions)
```nexa
extern "C" fn sqrt(x: f64) -> f64;

fn main() {
    print(sqrt(144.0));   // 12
}
```

### Error Handling
```nexa
fn divide(a: f64, b: f64) -> Result<f64, string> {
    if b == 0.0 {
        return Err("Division by zero");
    }
    return Ok(a / b);
}
```

## Examples

### Hello World
```nexa
fn main() {
    print("Hello, World!");
}
```

### Fibonacci
```nexa
fn fib(n: i32) -> i32 {
    if n < 2 { return n; }
    return fib(n - 1) + fib(n - 2);
}

fn main() {
    let mut i = 0;
    while i < 10 {
        print(fib(i));
        i = i + 1;
    }
}
```

### Factorial
```nexa
fn factorial(n: i32) -> i32 {
    if n <= 1 { return 1; }
    return n * factorial(n - 1);
}

fn main() {
    print(factorial(10));  // 3628800
}
```

## Deployment

### Compile for Linux
```bash
nexa build app.nx -o myapp
./myapp
```

### Docker
```bash
nexa build app.nx -o myapp --target docker
docker build -t myapp .
docker run myapp
```

### Systemd Service
```bash
nexa build app.nx -o myapp --target server
sudo cp myapp.service /etc/systemd/system/
sudo systemctl enable myapp
```

## Documentation

- [Full Language Reference](https://github.com/aliclan786k-pixel/nexa/blob/main/docs/language.md)
- [CLI Commands](https://github.com/aliclan786k-pixel/nexa/blob/main/docs/cli.md)
- [Core Specification](https://github.com/aliclan786k-pixel/nexa/blob/main/spec/core.md)

## Support

- GitHub: https://github.com/aliclan786k-pixel/nexa
- Issues: https://github.com/aliclan786k-pixel/nexa/issues

## License

MIT License
