SPVM - SPVM Language
SPVM is a statically typed programming language with the syntax of Perl.
SPVM has not yet reached a stable release of version 1.0. For now, backward compatibility of methods and features will not be kept.
A class of SPVM:
# lib/SPVM/MyMath.spvm class MyMath { C<static method sum : int ($nums : int[])> my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } }
Calling a SPVM method from Perl:
# sum.pl use FindBin; use lib "$FindBin::Bin/lib"; use SPVM 'MyMath'; # Call method my $total = SPVM::MyMath->sum([3, 6, 8, 9]);
Tutorial - SPVM Tutorial
Language Specification - SPVM Language Specification
Standard Modules - SPVM Standard Modules
ExchangeAPI - Exchange APIs
Native Class - Native Class
Native APIs - Native APIs
Resource - Resource
spvmcc - Creating Executable File
spvmdist - Creating SPVM Distribution
Benchmark - SPVM Performance Benchmarks
use SPVM; use SPVM 'SomeClass';
Loads the SPVM module.
If a class name of SPVM is given as the first argument, the SPVM module is loaded and is bound to a Perl module.
The bound Perl class name is prefixed with SPVM::.
SPVM::
Exceptions:
If the SPVM module cannot be loaded, an exception is thrown.
Examples:
use SPVM 'Int'; my $int_object = SPVM::Int->new(3); my $value = $int_object->value.
my $api = SPVM::api();
Gets the global SPVM::ExchangeAPI object for this Perl interpreter.
If an environment variable is an empty string, it is treated as an undefined value.
A directory for files generated by the compiler and linker.
C source codes for precompilation, dynamic link libraries and object files are stored into this directory.
These files are output when attempting to build a module containing methods with the native attribute or the precompile attribute.
native
precompile
If these files are output and the directory given by the SPVM_BUILD_DIR environment variable does not exist, an exception is thrown. Examples:
SPVM_BUILD_DIR
# bash export SPVM_BUILD_DIR=~/.spvm_build # csh setenv SPVM_BUILD_DIR ~/.spvm_build
If the SPVM_CC_DEBUG environement variable is a true value of Perl, debug messages and messages from the SPVM native class compiler and linker are printed to stderr.
SPVM_CC_DEBUG
If the SPVM_CC_QUIET environement variable is a true value of Perl, messages the SPVM native class compiler and linker are not printed to stderr.
SPVM_CC_QUIET
If it is defined and a false value of Perl, the messages are printed.
This setting has a higher priority than the quiet field of the SPVM::Builder::Config module.
If the SPVM_CC_FORCE environement variable is a true value of Perl, the compilation and link by the SPVM native class compiler and linker are forced.
SPVM_CC_FORCE
This setting has a higher priority than the force field of the SPVM::Builder::Config module.
SPVM - Github
Yuki Kimoto <kimoto.yuki@gmail.com>
moti<motohiko.ave@gmail.com>
Mohammad S Anwar
akinomyoga
NAGAYASU Shinya
Reini Urban
chromatic
Kazutake Hiramatsu
Yasuaki Omokawa
Suman Khanal
Ryunosuke Murakami
Yoshiyuki Itoh
Tore Aursand
greengorcer
Copyright (c) 2023 Yuki Kimoto
MIT License
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.