Silver (programming language)
| File:Silver (programming language official logo).svg | |
| Paradigm | Multi-paradigm: imperative, structured, object-oriented |
|---|---|
| Designed by | Edan Matayev |
| Developer | Edan Matayev |
| Stable release | 0.7.9.4[1]
|
| Typing discipline | Strong[2] |
| License | Open source[citation needed], proprietary[2] |
| Filename extensions | .sr (source), .srp (project manifest) |
| Website | silverlang |
| Major implementations | |
| silverc, silveri | |
| Influenced by | |
| C, C++, C#, Java, JavaScript, PHP, Python, Rust, TypeScript[citation needed] | |
Search Silver (programming language) on Amazon.
Silver is a low-level programming language with high-level syntax, created by Edan Matayev for systems programming.[citation needed] It combines type-first declarations and brace-delimited blocks with classes, properties, and collection operations. Its toolchain provides native compilation through silverc and direct source execution through the silveri interpreter.[2][3] Source files use the extension .sr; project manifests use .srp.[3]
Design
Silver combines native machine code and direct operating-system interfaces with syntax for classes, properties, and methods. Its library conventions place buffers, operating-system handles, and other implementation details behind public interfaces with descriptive names. Both layers are written in Silver.[citation needed]
The language provides classes, constructors, inheritance, nullable and union types, pattern matching, dynamic arrays, and string interpolation. Its standard-library documentation covers filesystem operations, networking, JSON, and system facilities.[2]
Memory safety
The memory-safety specification defines a compiler pass called the Memory Guard. It requires checks for ownership, lifetimes, aliasing, initialization, and address validity before code generation, with rejection of programs whose safety cannot be established. The specification uses alias for references and fixed for address-related declarations.[citation needed]
Syntax and semantics
Declarations place a type before a variable or function name, with optional type inference through var. Nullable types use a ? suffix, union types use forms such as <float64 | string>, and interpolated strings begin with $.[2]
Functions declare their return type before the function name and place parameters in parentheses. A conventional program entry point is void main().[citation needed] The following Hello world program writes a line of text:[3]
void main() {
printline("Hello, world!");
}
Classes use construct for constructors, new for instance creation, and this to access the current instance. Properties can be declared with prop. This example defines a class with a property, constructor, and method:[3]
class Greeter {
public prop string name;
construct(string name) {
this.name = name;
}
public string greet() {
return $"Hello, {this.name}!";
}
}
void main() {
Greeter greeter = new Greeter("Silver");
printline(greeter.greet());
}
Modules group declarations, while imports make declarations available to other source files. The documented control-flow constructs include conditional statements, loops, pattern matching, and exception handling with try and catch.[citation needed]
Implementations
Silver's toolchain includes a Rust bootstrap compiler, a compiler written in Silver, and an interpreter written in Silver. New features are implemented in the bootstrap compiler first, then in the Silver compiler and interpreter.[citation needed]
Compiler
The compiler's x86-64 instruction encoder constructs machine instructions as bytes and resolves label relocations internally.[4] The documented Windows backend produces Portable Executable files and calls Windows system DLL exports through the executable's import table.[citation needed]
Interpreter
The interpreter executes Silver source files without first producing a native executable. It accepts a source filename directly or through the -i option. Its documented options also include persistent bytecode and object caches.[3]
Licensing
Silver is described as having open-source and proprietary licensing.[citation needed] The compiler and interpreter repositories carry proprietary, all-rights-reserved notices.[1][3]
References
- ↑ 1.0 1.1 "silverc.srp". GitHub. Retrieved 2026-10-27.
- ↑ 2.0 2.1 2.2 2.3 2.4 "Silver Compiler". GitHub. Retrieved 2026-10-27.
- ↑ 3.0 3.1 3.2 3.3 3.4 3.5 "Silver Interpreter". GitHub. Retrieved 2026-10-27.
- ↑ "mini_asm.sr". GitHub. Retrieved 2026-10-27.
External links
This article "Silver (programming language)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Silver (programming language). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
