An English-like programming language that compiles to native executables. HumanScript is designed for simplicity and readability, abstracting away complex syntax while providing core programming functionalities like variables, control flow, file operations, and system interaction.
Version 3.0 is a major evolutionary leap, transforming HumanScript into a truly powerful and modern scripting language while retaining its core philosophy of simplicity and readability.
- The most significant change is the complete shift from generating Assembly language to generating Nim. This is a massive architectural improvement.
- Why Nim? It's a modern, high-performance, garbage-collected language with a Python-like syntax but C-like speed. It compiles to C, then to native code, giving us the best of all worlds: performance, safety, and portability.
- We can now support complex arithmetic expressions with proper operator precedence, just like Python, C#, or C++.
- Example:
set result to 10 plus 5 times 2;now correctly evaluates to20(multiplication happens before addition).
- A long-requested feature is finally here! You can now nest
if,else, andrepeatstatements inside each other, and inside functions. - This allows for much more complex and powerful program logic, such as loops inside conditionals, or conditionals inside loops.
- Example: A
repeatloop that contains anifstatement to break out of the loop under a certain condition.
- A new command
read file "path.txt" and store it in variablehas been added. - This allows your programs to read configuration files, process logs, or handle user-generated content from previous runs.
- The parser has been significantly refactored to handle nested structures and complex expressions gracefully.
- The code generator now correctly translates all these new features into clean, efficient Nim code.
- Blocks: All control structures (
if,repeat,function) now use[and]for clear, C-style block delimiters instead of relying on indentation. This is more robust and familiar to programmers from other languages. - Semicolons: All statements now end with a semicolon
;, enforcing a clear and consistent statement structure.
- By compiling to Nim and then to C, we are no longer limited to Windows-specific assembly tools. The same HumanScript compiler can now run on Linux and macOS and produce native executables for those platforms.
In short, version 3.0 transforms HumanScript from a simple toy language into a genuinely powerful and modern scripting language, while keeping its core goal of being human-readable.
Windows 10, 11, Server (2016+)
Linux (Ubuntu, Debian, CentOS, etc.)
macOS (10.12+)
- Features
- Requirements
- Installation
- Getting Started
- Language Syntax
- How It Works
- Contributing
- License
Write code that reads like plain English, making it accessible to beginners and non-programmers.
Variables:
define name as "John".Printing:
print "Hello, World!".Comments:
# This is a comment.
Work with numbers and strings using intuitive commands.
Arithmetic:
add 5 to score.orset total to price plus tax.String Concatenation:
set full_name to first_name combined with last_name.Type Conversion:
turn age to text as age_text.
Implement logic with natural language conditions and loops.
Conditionals:
if age is greater than 18:,else if:,else:Loops:
repeat 5 times...]
Interact with the underlying operating system and other processes.
Run Processes:
run process "notepad.exe".File I/O:
write "Log entry" to "C:\logs\app.log".Pause Execution:
wait for 3 seconds.
Organize your code into reusable blocks.
Define Function:
define function named say_hello...]Call Function:
run function say_hello.
Communicate with the user via the console.
Get Input:
store console input in user_name.Print Output:
print "Welcome, ".print user_name.
To compile HumanScript code, you need the following tools:
Windows/Linux/macOS (to run the compiler and the output)
.NET 8 SDK (to build the HumanScript compiler from source)
Nim Compiler (version 2.0+): For compiling the generated Nim code
GCC or MinGW (included with Nim installation): For C compilation backend
Note: The Nim compiler and GCC are automatically handled by the HumanScript compiler. No manual installation of assembly tools required!
Clone the repository:
git clone https://github.com/your-username/HumanScript.git cd HumanScript
Install Nim (if not already installed):
Windows: Download from nim-lang.org
Linux:
sudo apt install nimor use choosenimmacOS:
brew install nimor use choosenim
Compile the Compiler:
dotnet build
The compiled HumanScript.exe will be in the bin\Debug\net8.0 directory. You can copy it to the project root for convenience.
Create a HumanScript file (e.g.,
hello.eng):
# hello.eng define message as "Hello from HumanScript!". print message.
Compile your script:
HumanScript.exe hello.eng
Run the resulting executable:
hello.exe
Output:
Hello from HumanScript!
Here is a quick reference for the available commands in HumanScript.
define my_number as 42. define my_string as "This is a string". define is_ready as true.
define counter as 0. add 10 to counter. subtract 5 from counter. multiply counter by 2. divide counter by 3.set total to price plus tax. set result to base_value times multiplier.
define first_name as "John". define last_name as "Doe". define full_name as "".set full_name to first_name combined with last_name. print full_name. # Outputs: JohnDoe
define age as 30. define age_text as "". turn age to text as age_text.
define score as 85.if score is greater than 90: print "Excellent!". else if score is greater than 70: print "Good job!". else: print "Keep trying".
repeat 3 times [ print "This will print 3 times". ]
define function named greet [ print "Hello there!". ]print "Calling a function...". run function greet. print "Function finished.".
# Run an external program run process "calc.exe".wait for 2 seconds.
write "Log entry at 10:00 AM" to "C:\temp\log.txt".
define user_data as "User: Alice". write user_data to "C:\temp\users.txt".
The HumanScript compiler translates your readable .eng file into a native executable through a streamlined process:
Parsing:
HumanScript.exereads your.engsource file and validates the syntax.Code Generation: It generates clean Nim code, saving it as
temp.nim.Compilation: It calls the Nim compiler to compile
temp.niminto an optimized executable.Optimization: Nim compiles to C, which is then compiled to native machine code for maximum performance.
Your Code (.eng) -> HumanScript Compiler -> Nim Code (.nim) -> Nim Compiler -> Executable (.exe)
Contributions are welcome! If you have a feature request, bug report, or a pull request, please open an issue or submit a pull request.
Fork the repository.
Create a new branch (
git checkout -b feature/amazing-feature).Commit your changes (
git commit -m 'Add some amazing feature').Push to the branch (
git push origin feature/amazing-feature).Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.