Repository navigation
Releases
Violette v0.3.0
Violette v0.3.0
This release introduces revising compiler architecture via using typed AST, many language syntax improvements and fixes, new features, like slices and many more...
-
Typed AST: Made new module in the compiler and revised typechecker logic from checking type mismatches to building a new AST, with which the codegen works. It allows removing any logic, connected with type checking, from codegen, so, since now it literally only generates code. Since adding that feature Violette will be able to have more than one way to be compiled, like, generating LLVM IR or CLIF for Cranelift.
-
Arrays and Slices: Added arrays and slices for all primitive and
structtypes. Supported indexing and slicing arrays via range syntax constructs,..<or..=. -
Labeled Params: Added Swift-like labeling function parameters model with two identifiers: external label and internal name, for example:
func greet(to name: String, from sender: String) { println("Hello, " + name + " from " + sender) } greet(to: "Alice", from: "me") greet(from: "you", to: "Alice") greet("Alice", from: "her")
Unlike Swift, in Violette you can change labeled parameters order in function call. All
greetfunction call in this example are correct in Violette. -
New Syntax for Methods: Since this release you can give your own name to the object, like in Go
struct Point { x: Float64, y: Float64, } extend Point { func new(x: Float64, y: Float64) -> Point { return Point { x: x, y: y } } func (p: Self) distance(other: Point) -> Float64 { let dx = p.x - other.x let dy = p.y - other.y return ((dx * dx) + (dy * dy)).sqrt() } }
If function declared in
extend-block without parens afterfunckeyword, like thenewfunction in this example, it will be a static method. Otherwise, the name you will give in the parens will be assigned to the object. No reserved keywords likeselforthis. -
Enums:
variantis changed toenumfor greater familiarity in case you are Rust/Swift/Scala 3 developer -
New Lambda Syntax: Since now lambdas are just blocks of code, which use numbered parameters, e.g.
#0,#1, etc.
Named parameters in lambdas are just variableslet add: fun(Int, Int) -> Int = { #0 + #1 } // lambda which takes two integer numbers and return their sum let subtract: fun(Float64, Float64) -> Float64 = { let a = #0 // first named parameter let b = #1 // second named parameter a - b // result }
-
Optional Parens in Operator Sections: Parens are no more required in functions/methods calls
func filter_print(x: Int, predicate: fun(Int) -> Bool) { if predicate(x) { println(x) } } func main() { filter_print(10, > 5) filter_print(3, > 5) filter_print(7, != 7) filter_print(42, != 7) }
But you can still use them
-
Double Inequalities: Added support for double comparison operators (e.g.,
a < b < c)func inc(var num: Int) -> Int { num++ return num } func main() { let x = 0 if 0 < inc(x) < 2 { println("x: " + inc(x).toString()) } else { println("unreachable") } }
Violette v0.2.0
Violette v0.2.0: Major Syntax Overhaul & Block-Scoped Defer
This release introduces significant ergonomic improvements to the language syntax, introduces block-scoped resource management, and turns if into a first-class expression.
What's New
- Block-Scoped LIFO
defer:
Introduced Zig-style lexical defer statements. Deferred calls execute in strict Last-In-First-Out (LIFO) order upon exiting their enclosing block{ ... }, on loop iterations, and before earlyreturnstatements. ifas a First-Class Expression:
if / else if / elsecan now be used as expressions to yield values.- Inline
ifSyntactic Sugar (:):
Added optional Python/Nim-style colon syntax for concise one-liners:
func sign(x: Int) -> Int = if x > 0: 1 else if x == 0: 0 else: -1 - Clean Return Syntax (
->):
Replaced square brackets[Type]with standard modern arrow notation-> Type. - PascalCase Unified Types:
Standardized all built-in types to PascalCase (Int,String,Float64,Bool). Removed primitive distinctions from AST. - Modern Algebraic Data Types (Variants):
Redesigned variant definitions to use clean block syntax:
variant Result { Win(Int), Fail(String) } - Restored Bitwise OR (
|):
Freed up|from variant definitions and restored it as the standard bitwise OR operator (replacing#). - Clean Module Imports (
using):
Replacedimportwith Haskell-like syntax:using math (sqrt, abs). - Standardized Ranges:
Ranges now follow standard syntax:0..10(exclusive) and0..=10(inclusive).
Violette v0.1.0
Violette v0.1.0
The first release of the Violette programming language compiler
Violette is a statically typed systems programming language compiling down to C with deterministic memory management with no GC overhead
What's in this release:
-
Syntax:
- Haskell-like operator sections:
(> 5),(== 0) - First-class binary operators as functions:
(+),(*),(**),(-) - Pipeline operator
~>(Sprout):data ~> transform ~> validate - Expression-bodied functions:
func add(a: int, b: int) [int] = a + b - new return type syntax:
func foo() [ReturnType] - Inclusive (
..) and exclusive (:) range expressions
- Haskell-like operator sections:
-
Systems Semantics & Safety:
- Value semantics on the stack by default
- Explicit mutable references:
var a: &intfor safe in-place mutations - UFCS (Uniform Function Call Syntax) methods on primitives and
extend-blocks for structs - C runtime with reference-counted strings
-
Compiler & Tooling:
- Gleam-style compiler diagnostics with source line frames, secondary labels, and helpful hints
- Integration test suite (
Viotestte, 38 tests)
Violette by Krev3tka