Get Started
Introduction
Nature is a general-purpose open source programming language and compiler that aspires to provide developers with a simple and elegant development experience that can simply and efficiently build secure and reliable cross-platform software.
Features
- ✓ Simple, natural, and consistent syntax design
- ✓ Independent compilation system, no dependency on llvm, supports cross-platform compilation
- ✓ Well-formed type system with support for generics, null-value safety, and error handling
- ✓ Automated GC, with very short STW
- ✓ Modularity and package management system, npkg
- ✓ Built-in shared-stack concatenation, millions of concatenation switches per second
- ✓ Built-in libuv cooperates with the concatenation to handle IO event loops
- ✓ Built-in implementations of common data structures and standard libraries, and easy interaction with C
- ✓ Editor lsp support
- ○ Asymptotic GC, capable of manual memory management
- ○ Tests DSLs, efficient and stable use of AI coding
- ○ macho cross-platform connector, currently lacks the macho linker darwin can't be cross-platform compilation.
- ○ Improvement of collaborative scheduling system
- ○ Cross-platform compilation support for wasm and risc64 platforms
- ○ Compilation to readable golang programming language
Project Overview
The nature programming language has reached a usable version, and the syntax APIs are basically stable, there will not be any drastic changes before version 1.0, but there are some minor syntax changes.
The current version of nature source code supports compilation on the following target platforms
- linux/amd64
- linux/arm64
- darwin/amd64
- darwin/arm64
nature includes a set of test cases and a standard library to test the usability of the syntax, but it has not been tested on a medium to large scale project, and so there are still many bugs.
Major work in the next versions of The main work is
- Standard library refinement
- Gathering user feedback
- Project validation and bug fixes
- Refinement of language features
- Compilation into a readable golang programming language to increase the usability of the nature programming language
Design Philosophy
golang is the programming language I work with. It has a simple syntax, a very good and high-performance cross-platform compiler and runtime implementation, an advanced concurrent design style and high-performance network I/O, as well as good support for standard libraries. However, there are some inconveniences.
- Syntax is too simple, leading to lack of expressiveness.
- Type system is not perfect, lack of nullable, enum parameters, generic (now available), etc.
- Error handling is cumbersome.
- GC and preemptive scheduling, although very good, but it also limits the scope of golang's applications in areas such as GUI, OS, game development, and AI.
nature is designed to be a continuation and optimization of the golang programming language, and pursues certain differences, as described in the Features section.
Based on the existing features of the nature programming language, it is suitable for game engines and game development, scientific computing and AI, OS and IoT, and web development.
Suggestions for Use
As an early programming language, it is currently suitable for the following types of developers
-
technology explorers
- Developers who are curious about new technologies
- Developers who are curious about new technologies, willing to try new things, and able to live with the bugs that existed in earlier versions.
- Interested in participating in discussions about language design and improvement.
-
language developers and researchers
- Developers interested in programming language design and implementation.
- Researchers in compilation principles
- Learners who want to learn how to implement a programming language.
-
Feedback Contributors
- Developers who are willing to provide feedback on their use of the language.
- Developers who are willing to provide feedback on their use of the language.
- Interested in contributing to projects and standards library improvements
Not applicable to the following types of developers
- enterprise users who need to use in production environment
- project developers who require high stability.
- Programming beginners
- developers who need a lot of third-party library support
Installation
1️⃣ Download the binary zip for your system at https://github.com/nature-lang/nature/releases and extract it.
2️⃣ Move the nature folder to the /usr/local
directory. If you need to install nature in another directory, manually set the NATURE_ROOT environment variable to point to the nature directory.
/usr/local/nature/
├── LICENSE-APACHE
├── LICENSE-MIT
├── VERSION
├── bin
├── lib
└── std
└── std
3️⃣ Add the /usr/local/nature/bin
directory to the system environment variables, e.g. cat ~/.zshrc
...
export PATH="/usr/local/nature/bin:$PATH"
...
4️⃣ Run the command nature --version
to view the current version
> nature --version
nature v0.5.0-beta - release build 2025-02-22
5️⃣ Run the command nature -h
to see the available commands
> nature -h
Nature Programming Language Compiler vx.x.x
Usage.
nature [command] [flags] [arguments]
...
Hello Nature
Create the main.n file
import fmt
fn main() {
fmt.printf('hello nature')
}
Compile and run the binary main
> nature build main.n && . /main
hello nature
Specify the target platform and architecture
> nature build --target darwin_amd64 main.n
Specify that the output binary is called hello
> nature build -o hello main.n
Example project
- parker lightweight packaging tool
- llama.n Llama2 nature language implementation
- tetris Tetris based on raylib, macos only.
- playground playground server api implementation
Editor support
The lsp server nls
has been installed in the /usr/local/nature/bin directory along with the nature installer.
ls -lh /usr/local/nature/bin
total 44696
-rwxr-xr-x@ 1 root wheel 764K Feb 24 13:18 nature
-rwxr-xr-x@ 1 root wheel 6.1M Feb 24 13:20 nls
-rwxr-xr-x@ 1 root wheel 15M Feb 24 13:20 npkg
Search for nature language in the vscode extension store and download it.
Learn more
Syntax documentation - A detailed description of the syntax of the Nature language.
Standard Library Documentation - Nature Standard Library API reference.
Contribution Guidelines - How to get involved in Nature language development.