SPVM - Static Perl Virtual Machine. Fast Calculation, Fast Array Operation, and Easy C/C++ Binding.
SPVM Module:
# lib/MyMath.spvm package MyMath { sub sum : int ($nums : int[]) { my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } }
Call SPVM subroutine from Perl
# spvm.pl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use SPVM 'MyMath'; # Call subroutine my $total = MyMath->sum([3, 6, 8, 9]); print "Total: $total\n"; # Call subroutine with packed data my $nums_packed = pack('l*', 3, 6, 8, 9); my $sv_nums = SPVM::new_int_array_from_bin($nums_packed); my $total_packed = MyMath->sum($sv_nums); print "Total Packed: $total_packed\n";
Precompiled SPVM Subroutine. This code is converted to C language and then converted to a shared library.
# lib/MyMath.spvm package MyMath : precompile { sub sum : int ($nums : int[]) { my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } }
SPVM is Static Perl Virtual Machine. SPVM is a programming language which has Perlish syntax. SPVM provides fast Calculation & easy C/C++ Binding.
Fast culcuration, Fast array operation
Precompile Subroutine, Easy way to C/C++ binding, C99 math functions
Perlish syntax, Static typing, Type inference
Reference count GC, Weaken reference, Exception, Module
Object oriented programming
See SPVM Tutorial at first. If you want to know SPVM language, see SPVM Language Specification. If you know SPVM core module, see SPVM Core Modules If you check SPVM performance, see SPVM Performance Benchmark. If you want to convert Perl Data structres to SPVM data structures, see SPVM Exchange API. If you call C function from SPVM, see SPVM Native API.
SPVM::Document::Tutorial
SPVM::Document::LanguageSpecification
SPVM::Document::Modules
SPVM::Document::Benchmark
SPVM::Document::ExchangeAPI
SPVM::Document::NativeAPI
SPVM build directory for precompile and native subroutine.
If SPVM_BUILD_DIR environment variable is not set, SPVM can't compile precompile subroutine and native subroutine, and a exception occur. You see error message "SPVM_BUILD_DIR environment variable must be set ...".
In bash, you can set SPVM_BUILD_DIR to the following.
export SPVM_BUILD_DIR=~/.spvm_build
This release is beta release before SPVM 1.0. The features is changed without warnings.
SPVM - Github
GitHub Issue
Github Discussions
Yuki Kimoto <kimoto.yuki@gmail.com>
moti<motohiko.ave@gmail.com>
Mohammad S Anwar
akinomyoga
NAGAYASU Shinya
Reini Urban
chromatic
Kazutake Hiramatsu
Yasuaki Omokawa
Copyright 2018-2021 Yuki Kimoto, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
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.