https://github.com/nula-lang/nula
https://github.com/nula-lang/nula
compiler development go golang good-first-issue help-wanted interpreter language-design mentor-needed nula nula-lang programming-language python rust rust-lang zig ziglang
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nula-lang/nula
- Owner: Nula-Lang
- License: mit
- Created: 2025-09-28T16:22:34.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-10-06T06:34:07.000Z (4 months ago)
- Last Synced: 2025-10-06T08:42:46.715Z (4 months ago)
- Topics: compiler, development, go, golang, good-first-issue, help-wanted, interpreter, language-design, mentor-needed, nula, nula-lang, programming-language, python, rust, rust-lang, zig, ziglang
- Language: Rust
- Homepage: https://nula-lang.github.io/Nula-Website/
- Size: 457 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
= Nula - Programming Language
:doctype: book
:toc: left
:toclevels: 4
:sectnums:
:icons: font
:source-highlighter: rouge
:sectanchors:
:sectlinks:
== Introduction
**Nula** is a modern, user-friendly programming language designed for simplicity and efficiency. It boasts a clean and readable syntax, delivering performance comparable to C through the use of Zig, while also supporting interpreted execution via Python. Additionally, Nula facilitates easy translation of code from other languages, such as Python, directly into Nula syntax.
Nula was created on September 28, 2025.
=== Key Features
* **Simple Syntax**: Uses intuitive commands like `write` instead of `print` for output.
* **Comments**: Single-line comments start with `@`.
* **Code Translation**: Embed and translate code from other languages using constructs like `# = python = {print("hi")}`.
* **Dependency Management**: Import dependencies with `<(dependency)>` or via files like `bottles.nula`.
* **CLI Tools**: Comprehensive command-line interface with commands such as `help`, `build`, `run`, `create`, and `install {dep}`.
* **High Performance**: Achieves near-C performance by leveraging Zig for compilation.
* **Interpreted Mode**: Run code interpretively using Python for quick testing and development.
* **Cross-Platform**: Supports Windows, Linux, Unix, macOS, and atomic Linux distributions.
== Installation Guide
This section provides detailed instructions for installing Nula on various operating systems. Choose the method that suits your environment.
=== Standard Installation
==== Windows
To install on Windows, download the installation script and execute it with administrative privileges.
.Download the Script
[source,powershell]
----
curl -L -o "$env:TEMP\install.ps1" https://raw.githubusercontent.com/Nula-Lang/Nula/main/install/install.ps1
----
.Run the Script as Administrator
[source,powershell]
----
Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `\"$env:TEMP\install.ps1`\""
----
==== Linux, Unix, and macOS
For Unix-like systems, download the script to a temporary directory and run it with elevated permissions.
.Download the Script
[source,bash]
----
curl -L -o /tmp/install.sh https://raw.githubusercontent.com/Nula-Lang/Nula/main/install/install.sh
----
.Run the Script
[source,bash]
----
cd /tmp && sudo chmod +x ./install.sh && ./install.sh
----
=== Building from Source
If you prefer to build Nula from source code, follow these steps. This is recommended for developers or those who want the latest features.
==== Windows
.Download the Build Script
[source,powershell]
----
curl -L -o "$env:TEMP\build-from-source.ps1" https://raw.githubusercontent.com/Nula-Lang/Nula/main/install/build-from-source.ps1
----
.Run the Build Script as Administrator
[source,powershell]
----
Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `\"$env:TEMP\build-from-source.ps1`\""
----
==== Linux, Unix, and macOS
.Download the Build Script
[source,bash]
----
curl -L -o /tmp/build-from-source.sh https://raw.githubusercontent.com/Nula-Lang/Nula/main/install/build-from-source.sh
----
.Run the Build Script
[source,bash]
----
cd /tmp && sudo chmod +x ./build-from-source.sh && ./build-from-source.sh
----
==== Linux Atomic Distributions
.Download and Modify the Build Script
[source,bash]
----
curl -L -o /tmp/build-from-source.sh https://raw.githubusercontent.com/Nula-Lang/Nula/main/install/build-from-source.sh && sed -i 's/is_atomic=false/is_atomic=true/' /tmp/build-from-source.sh
----
.Run the Build Script
[source,bash]
----
cd /tmp && sudo chmod +x ./build-from-source.sh && ./build-from-source.sh
----
[NOTE]
====
Building from source requires dependencies like Zig and Python to be installed on your system. Refer to the official Zig and Python documentation for installation instructions.
====
== Getting Started with Nula
=== Basic Syntax
Nula's syntax is designed to be intuitive and minimalistic, reducing the learning curve for new users.
==== Outputting Text
Instead of traditional `print` statements, Nula uses `write`:
[source,nula]
----
write "Hello, World!"
----
==== Comments
Comments are prefixed with `@`:
[source,nula]
----
@ This is a comment
write "This is visible"
----
==== Variables and Data Types
Nula supports basic data types similar to Python, with a straightforward declaration syntax.
[source,nula]
----
let x = 10
let message = "Hello"
write message + " " + x @ Outputs: Hello 10
----
=== Code Translation
One of Nula's unique features is the ability to translate code from other languages inline.
.Example: Translating Python Code
[source,nula]
----
# = python = {print("Hello from Python!")}
----
This translates to Nula's equivalent: `write "Hello from Python!"`
=== Managing Dependencies
Dependencies can be included using angle brackets or specific files.
.Example: Including a Dependency
[source,nula]
----
<(math)>
write math.sqrt(16) @ Outputs 4
----
Alternatively, use package files like `nula.toml` for managing multiple dependencies.
== CLI Commands
Nula provides a powerful command-line interface for managing projects and execution.
[cols="1,3"]
|===
|Command |Description
|`help`
|Displays help information and available commands.
|`build`
|Compiles the Nula code to an executable using Zig for high performance.
|`run`
|Runs the Nula script in interpreted mode using Python.
|`create`
|Creates a new Nula project or file template.
|`install {dep}`
|Installs a specified dependency.
|`update-nula`
|Updates Nula binaries to the latest version.
|`remove {dep}`
|Removes an installed dependency.
|`update`
|Updates all installed dependencies.
|`check`
|Validates .nula code for syntax errors.
|`init`
|Initializes a new Nula project.
|`fmt`
|Formats Nula code for consistency.
|`resolve`
|Resolves dependency conflicts.
|`test`
|Runs tests for Nula projects.
|===
.Example Usage
[source,bash]
----
nula run hello.nula
----
== Advanced Topics
=== Performance Optimization
By compiling with Zig, Nula achieves performance close to native C code. Use the `build` command for production deployments to optimize execution speed.
=== Interpreted vs. Compiled Mode
- **Interpreted (Python)**: Ideal for rapid development and testing, allowing quick iterations without compilation.
- **Compiled (Zig)**: Suited for performance-critical applications where speed is paramount.
=== Translating from Other Languages
Nula supports translation from languages like Python, enabling developers to migrate existing codebases seamlessly.
== Examples
=== Hello World
.File: hello.nula
[source,nula]
----
write "Hello, World!"
----
.Run Command
[source,bash]
----
nula run hello.nula
----
=== Simple Calculation with Translation
.File: calc.nula
[source,nula]
----
# = python = {
def add(a, b):
return a + b
print(add(5, 3))
}
----
This translates the Python function and outputs: 8
=== Working with Dependencies
.File: math_example.nula
[source,nula]
----
<(math)>
let result = math.sqrt(25)
write "Square root of 25 is " + result @ Outputs: Square root of 25 is 5
----
== Contributing to Nula
Nula is an open-source project hosted on GitHub at https://github.com/Nula-Lang/Nula/. Contributions are welcome! To contribute:
1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes and test thoroughly.
4. Submit a pull request with a clear description of your changes.
Check the repository for source code, issues, and pull request guidelines.
[TIP]
====
Before contributing, review the contribution guidelines in the repository's `CONTRIBUTING.md` file.
====
== Frequently Asked Questions
=== What makes Nula different from Rust or Zig?
Nula combines the simplicity of Python-like syntax with the performance of Zig, offering both interpreted and compiled modes for flexibility.
=== Is Nula production-ready?
As a new language (created in 2025), Nula is in its early stages. It is suitable for experimentation and prototyping, and we encourage community feedback to improve its readiness.
=== Where can I find more examples?
Visit the GitHub repository at https://github.com/Nula-Lang/Nula/ for additional examples, or contribute your own to the community.
== References
- Official Repository: https://github.com/Nula-Lang/Nula/
- Zig Documentation: https://ziglang.org/
- Python Documentation: https://www.python.org/
- Rust Documentation: https://doc.rust-lang.org/stable/
- Go Documentation: https://golang.org/