Name
SPVM - SPVM Language
Description
SPVM is a statically typed programming language that has Perl-like syntax.
SPVM has not yet reached a stable release of version 1.0. For now, there is currently no policy to keep the backward compatibility.
Usage
One Liner
Run a one liner.
# Hello World!
spvm -e 'say "Hello World!";';
Run a one liner with loading a class.
# foo,bar,baz
spvm -M Fn -e 'say Fn->join(",", ["foo", "bar", "baz"]);'
Executing A SPVM Program
Write a SPVM program.
# lib/SPVM/HelloWorld.spvm
class HelloWorld {
static method main : void () {
say "Hello World!";
}
}
Run the SPVM program.
spvm -I lib/SPVM HelloWorld
Generating An Executable File
Generate an executable file.
spvmcc -B ~/.spvm_build -o ./hello --no-config -I lib/SPVM HelloWorld
Run the executable file.
./hello
Calling A SPVM Method from Perl
Write a SPVM program.
# lib/SPVM/MyMath.spvm
class MyMath {
static method sum : int ($nums : int[]) {
my $total = 0;
for (my $i = 0; $i < @$nums; $i++) {
$total += $nums->[$i];
}
return $total;
}
}
Write a Perl program calling a SPVM method.
# sum.pl
use FindBin;
use lib "$FindBin::Bin/lib";
use SPVM 'MyMath';
my $total = SPVM::MyMath->sum([3, 6, 8, 9]);
print "$total\n";
Run the Perl program.
# Run
perl sum.pl
Features
Native threads and goroutines.
AOT(Ahead-of-time compilation) and JIT(Just-in-time compilation).
Static types, type inference and static analysis.
C and C++ binding and resource system for C and C++ libraries.
Perl-like syntax with class syntax.
Tutorial
Tutorial - SPVM Tutorial
Documents
Language Specification - SPVM Language Specification
Standard Modules - SPVM Standard Modules
ExchangeAPI - Exchange APIs
ExchangeAPI - Exchange APIs
Native Class - Native Class
Environment Variables - Environment Variables
Resource - Resource
spvm - Executing SPVM Programs
spvmcc - Creating Executable File
spvmdist - Creating SPVM Distribution
Benchmark - SPVM Performance Benchmarks
Repository
Author
Yuki Kimoto <kimoto.yuki@gmail.com>
Core Developers
moti<motohiko.ave@gmail.com>
Contributors
Mohammad S Anwar
akinomyoga
NAGAYASU Shinya
Reini Urban
chromatic
Kazutake Hiramatsu
Yasuaki Omokawa
Suman Khanal
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License