Releases: nature-lang/nature
Releases · nature-lang/nature
v0.4.0-beta
Features
- Compile-time error optimization, displaying filename and line number, type errors show original type identifiers
- Runtime error provides stack trace
- Multi-line comments
/****/
support - Import supports prefix-less import
import utils as *
- Small test cases parker
- Parameter destructuring support, example
call(...vec)
- Generic type supports recursion
type numbert = gen intergert|flotert
- Binary operators
||
&&
support - Package management import dir support, will automatically find dir's main.n
- Package management import xxx_temp support, can define temp files to interact with static libraries
- nature struct adjusted to be isomorphic with C, can directly pass nature struct to C language
- Data type
arr<T,len>
support, allocated on the stack, isomorphic to C'sT ident[len]
- New syntax support, nature struct defaults to stack allocation, can get a heap-allocated p through
ptr<person> p = new person
- Type constraints after as, like
var s = {} as {u8}
, declares a set type constrained to{u8}
, equivalent to{u8} s = {}
- Package management supports declaring links for static library linking and temps for template declaration
- New standard library for strings
import strings
- To better interact with C, new types
cptr
andcptr<T>
added - Added built-in syntax keyword sizeof to calculate type size, usage example
int s = sizeof(person)
- New standard libraries fmt/os/path/strings/time
- New template files (for interacting with C) builtin_temp (default import), dirent_temp, libc_temp, strings_temp, syscall_temp
Adjustments
- Type param can only be defined globally
- Global variables support type inference
- Removed set function, declare an empty set through as constraint
- List type definition adjusted to vec, supports declaring vec with original struct and specifying length, example
var terms = vec<u8>{len=12,cap=24}
- String type adjusted to be isomorphic with vec, supports accessing and assigning through
str[0]
, and supports for-in iteration - Vec type method list.len() adjusted to type attribute, list.len, and supports type methods like slice/concat
- For loop expression errors and break and continue redeclaration errors
- Generic type i = gen int|int64 basic types consistent when repeatedly generated
- Register allocation interval_add_range adds range error
- set.contains() calculates hash slot error
- Defining fn in struct exception
- Linker elf rela addend calculation exception, addend = next_inst_offset - current_inst_rel offset
- Ssa rename exception, some linear var def not renamed
- Ssa calc imm domer exception, recent domer cannot be itself
- If multi-line expression parser parsing exception
- Automatic GC trigger time exception, adjusted GC trigger point to user mode
- malloc allocates repeated memory areas, causing GC exception due to not clearing the area, malloc actively clears the allocated area
- Import priority exception, local ident can override import ident
- Fixed gcc11 global variable redefinition error #16
- Fixed Memory overflow
v0.3.0-beta
Features
- Package management tool
npkg
#10 - Cross-platform compilation based on file names, such as
main.linux.n
- Support for string symbol escaping, e.g.,
var str = 'hello\nworld'
- Support for coercing strings to
[u8]
and vice versa - Support for concatenating characters using the
+
operator and logical comparison between strings - Declaration of hexadecimal literal numbers, e.g.,
var i = 0x1A
- New standard library
syscall
for interacting with the operating system - New standard library
libc
for interacting with C language - Declaration of an empty list's type and length through type coercion, e.g.,
var list = [] as [u8,5]
- Maps and sets also support type declarations through empty value type coercion, e.g.,
var set = {} as {int}
- New built-in type
cptr
, equivalent to C language'svoid*
, commonly used for interacting with C language/OS - String and list types have a new chained method
raw()
, which directly accesses the raw data in the heap
Changed
- Changed for-loop iterator for lists from
k
tov
, e.g.,for v in list
- Errors generated by
try
no longer check for duplicate receiving variables - Support for function return values of type
void_expr()
- Fixed an issue with the assembler's
jmp rel8
instruction
v0.2.0-beta
Features
- Added support for continue and break syntax.
- Added as for type assertion and type coercion.
- Added is keyword for checking specific types in union and any types.
- Added let keyword for type inference.
- Added support for union types #12 .
- Added support for type aliases with parameters #13 .
- Added generic support for global functions #13 .
- Added support for null type and null safety. Compound types are no longer allowed to be assigned null, and variables must be initialized with a value.
- Added support for overload resolution based on parameter types for global functions.
Changed
- Changed catch keyword to a shorter try keyword.
- Variables must now be initialized upon declaration, and compound types are no longer allowed to be null.
- Removed mandatory parentheses for if and for statements. For example, if true {}.
- Changed double quotes to single quotes for characters.
- Renamed list.length() and map.length() to len.
- Renamed list.delete() and set.delete() to del.
- Renamed set.contains() to has.
- Fixed the issue where try syntax was not available in chained calls #11 .
- Fixed the issue where type aliases didn't support the module.type format.
- Temporarily disabled implicit type conversions, but literal assignments like i8 foo = 12 are still supported.
v0.1.0-beta
Features
- Variable definition and assignment
- Control flow statements
- Functions and closures
- Type system and custom types
- Unary and binary operators
- Support for struct structures
- Built-in list/map/set/tuple data structures
- Error handling Module management
- Cross-compilation, currently supporting the linux/amd64 target platform
- Memory allocation and automatic garbage collection
- Static single assignment (SSA)
- Reflection
- Register allocation