Neit requires clang
to be installed on your system for building code. However, clang
is not required to run the code using the interpreter.
Neit provides a set of easy-to-use command-line arguments for efficient development.
-
run
- Lexes, parses, (future) optimizes, and runs Neit code in the interpreter.
- Example:
neit run joy.nsc
-
build
- Lexes, parses, generates C code, and builds it with
clang
. - Example:
neit build joy.nsc
- Lexes, parses, generates C code, and builds it with
-
-h
or--help
- Displays help details about commands and options.
- Example:
neit -h
-
-grammar=<file>
- Specifies a grammar file for parsing. File extension does not matter.
- Example:
neit run joy.nsc -grammar=grammar.txt
-
-opt=<level>
- Specifies the optimization level for code generation.
1
– Least optimizations for minor speed improvements.2
– Moderate optimizations for a balance of speed and size.3
– Full optimizations for faster and smaller output.4
– Aggressive optimizations with longer compile times.
- Example:
neit build joy.nsc -opt=2
- Specifies the optimization level for code generation.
-
-static
- Generates a statically linked binary.
- Example:
neit build joy.nsc -static
-
-o=<name>
- Specifies the output file name (default:
output
). - Example:
neit build joy.nsc -o=mybinary
- Specifies the output file name (default:
-
-cls
- Clears the screen before running code (applies to the
run
command). - Example:
neit run joy.nsc -cls
- Clears the screen before running code (applies to the
-
-retain-c
- Retains the generated C file after building.
- Example:
neit build joy.nsc -retain-c
-
Declare a string variable:
may name = "joy"
-
Declare an integer variable:
may age = 16
-
Declare a float variable:
may height = 16.2
-
Refrence a variable to another variable:
may name2 = name
-
Print normal text:
print Hello world
-
Print the value of a variable:
print {name}
-
Single-line comments use the
#
symbol:# This is a single-line comment print Hello
-
Multi-line comments use
##
to begin and end:## Multi-line comment example: This spans multiple lines ##
- Take input from the user:
may name = takein() print {name}
- Clear the screen using the
cls
command:cls
-
Define a command (function):
cmd hi { (name:str) # Define parameters (currently ignored but required) println hi }
please note that the arguments are optinal and they can be empty , just put
()
-
Call a command:
call hi {"joy"}
-
If no arguments are required:
call hi
You can specify custom grammar rules to change commands. The format is:
<original_command> ~ <replacement>
print ~ say
This replaces print
with say
. You can now use say
instead of print
to output text, while still being able to use print
.
Note: Only commands can be changed, not other syntax elements.