About NovaScript

NovaScript is a low-level, environment-independent, autonomous programming language written in C from scratch. It represents an attempt to combine the readability of known scripting languages with the performance of compiled systems.

Core Project Pillars:

Development Goals

NovaScript aims to become a complete programming ecosystem, combining multiple roles in one language:

Language Design

NovaScript enforces clean code by completely rejecting block brackets { } and statement terminators ;. Logical blocks are defined using indentation:

Block Rule: Use exactly 4 spaces or one tab for indentation. Each command ends at the end of the line. Functions must end with the end keyword.

Function Implementation Example:

func main
    say "Hello Nova"
end

run main

Variables

Variables are a language feature currently under implementation — they allow storing data beyond the three basic hardware registers.

In Development

Planned Syntax:

var playerHealth 100
var name Nova

Functions

Functions in NovaScript are defined with the func keyword and called with the run command. Function body is determined by indentation. Every function must end with the end keyword to mark the boundary of the function scope.

func hello
    say Hello World
end

run hello

Math Operations

The A register serves as the main accumulator for arithmetic operations. The language is planned to support four basic operations:

func calculate
    set A 10
    add A 5
    sub A 2
    mul A 3
    div A 2
end

add and sub are already implemented in the interpreter. mul and div are on the planned extensions list.

Conditions

Conditional statements will allow controlling program flow based on register values. Like the rest of the language, they will be based solely on indentation — without brackets. Conditional blocks must end with end.

Planned

Planned Syntax:

if A > 10
    say Big
end

else
    say Small
end

Loops

Loops will allow repeated execution of a code block without manually duplicating instructions. Loop blocks must end with the end keyword.

Planned

Planned Syntax:

loop 10
    say Hello
end

Console Colors

NovaScript will enable terminal output styling through a simple color command without needing to manually type ANSI codes.

func showColors
    color red
    say Error
    color green
    say Success
    reset
end

Available Colors:

Register Virtual Machine (Low-Level VM)

Unlike traditional stack-based virtual machines, NovaScript uses a Register-Based architecture, modeled after x86-64 processors.

In the interpreter code, register states are directly mapped to native int memory cells in C. This ensures maximum performance for executing operations and minimal memory overhead.

Available Hardware Registers:

Calculation Example:

func math
    set A 10
    set B 20
    add A B
    say A  # Result in console: 30
end

Recursive Include System

NovaScript compiler implements modularity through direct file analysis at the parser level, without external text preprocessor involvement.

Recursive Analysis Cycle:

When the parser (compiler/parser.c) detects a TOKEN_INCLUDE token:

Instruction Set (ISA)

Specification of NovaScript processor commands. It forms the basic determinant for the parser and execution machine:

Instruction Arguments Operation Type Status
include String (path) Compilation Control Works
say Reg / String / Num Output (I/O) Works
set Reg (Target), Reg/Num (Source) Memory Management Works
add Reg (Target), Reg (Source) Arithmetic Works
sub Reg (Target), Reg (Source) Arithmetic Works
mul Reg (Target), Reg/Num (Source) Arithmetic Planned
div Reg (Target), Reg/Num (Source) Arithmetic Planned
func Identifier (Name) Code Flow Works
end None Code Flow Works
run Identifier (Name) Code Flow Works
var Identifier, Num/String Dynamic RAM In Progress
if / else Reg, Operator, Num/Reg Flow Control Planned
loop Num (repeat count) Flow Control Planned
color / reset Identifier (color name) Output (I/O) Planned

Compiler Architecture

A source file .nova goes through several processing stages before execution:

Standard Library Modules (std/)

The std/ directory structure was designed in a modular way to isolate code responsibility:

🎮 Game Module (std/game)

Native C wrapper over low-level graphics rendering pipeline. Abstraction hides screen buffer management and refresh:

import game
window 1280 720
player "hero.png"

Planned module scope includes: 2D engine, physics, sound, particles, input handling, animations, and networking.

🌐 Web Development Module (std/web)

Implemented using non-blocking network sockets (POSIX Sockets). Command launches an efficient event loop directly in C:

import web
server 8080
route /
    html "index.html"
end

Planned module scope includes: HTTP server, APIs, databases, WebSockets, and frontend tools.

Package Manager

Nova will have its own package manager for installing extensions and external libraries.

Planned

Planned Commands:

nova install graphics
nova install physics

nova update

nova remove package

Project Structure

The NovaScript repository is divided into the following directories:

NovaScript/

├── compiler/
├── runtime/
├── std/
├── packages/
├── examples/
├── tests/
└── vscode-extension/

Implementation Status

Current state of the language core:

FeatureStatus
Registers A B CReady
setReady
addReady
subReady
sayReady
FunctionsReady
funcReady
endReady
runReady
Indentation BlocksReady
VariablesIn Progress
if StatementsPlanned
LoopsPlanned
Compiler BackendPlanned
Package ManagerPlanned
Game EnginePlanned

Protocol for AI Developer Models

When generating compiler code or writing NovaScript programs, every AI model must strictly follow these structural assumptions:

1. Function block termination: Every function must end with the end keyword. Similarly, all control flow structures (if, else, loop) must be terminated with end.
2. No structural symbols: Prohibition on adding brackets {} and semicolons ;. Their presence generates an error like TOKEN_ERROR.
3. Command case-sensitivity: Always write language keywords in lowercase (e.g., set, func, end).
4. Register case-sensitivity: Always write machine register names in UPPERCASE (A, B, C).

Example of Incorrect Code Generation:

# ERROR! Uppercase, brackets, semicolons, and missing end
FUNC TEST {
    SET a = 10;
}

Example of Fully Correct NovaScript Code:

# CORRECT! Clean indentation, lowercase instructions, uppercase register, ends with end
func test
    set A 10
    say A
end

Priorities When Working on the Project

Every AI model supporting NovaScript development should follow this priority order: