<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">=encoding UTF-8

=head1 NAME

SPVM - Fast Calculation and Easy C/C++ Binding with perlish syntax and static typing

B&lt;SPVM is before 1.0 under development! I will change implementation and specification without warnings.&gt;

=head1 SYNOPSIS

=head2 Fast Array Operation using SPVM.

SPVM Module:

  # lib/SPVM/MyMath.spvm
  package MyMath {
    
    # Sub Declaration
    sub sum ($nums : int[]) : int {
      
      # Culcurate total
      my $total = 0;
      for (my $i = 0; $i &lt; @$nums; $i++) {
        $total += $nums-&gt;[$i];
      }
      
      return $total;
    }
  }

Use SPVM Module from Perl
  
  use FindBin;
  use lib "$FindBin::Bin/lib";
  
  # Use SPVM module
  use SPVM 'MyMath';
  
  # New SPVM int array
  my $sp_nums = SPVM::new_int_array([3, 6, 8, 9]);
  
  # Call SPVM subroutine
  my $total = SPVM::MyMath::sum($sp_nums);
  
  print $total . "\n";

If you know more SPVM syntax, see L&lt;SPVM::Document::Specification&gt;.

If you know more Functions to convert Perl Data to SPVM Data, see L&lt;SPVM::Document::Functions&gt;.

=head2 C Extension using SPVM

SPVM Module:

  # lib/SPVM/MyMathNative.spvm
  package MyMathNative {
    
    # Sub Declaration
    sub sum ($nums : int[]) : native int;
  }

C Source File;

  // lib/SPVM/MyMathNative.native/MyMathNative.c
  #include &lt;spvm_api.h&gt;

  int32_t SPVM__MyMathNative__sum(SPVM_API* api, SPVM_API_VALUE* args) {
    
    // First argument
    SPVM_API_OBJECT* sp_nums = args[0].object_value;
    
    // Array length
    int32_t length = api-&gt;get_array_length(api, sp_nums);
    
    // Elements pointer
    int32_t* nums = api-&gt;get_int_array_elements(api, sp_nums);
    
    // Culcurate total
    int32_t total = 0;
    {
      int32_t i;
      for (i = 0; i &lt; length; i++) {
        total += nums[i];
      }
    }
    
    return total;
  }

Use Extension Module from Perl:

  use FindBin;
  use lib "$FindBin::Bin/lib";
  
  # Use SPVM module
  use SPVM 'MyMathNative';
  
  # New SPVM int array
  my $sp_nums = SPVM::new_int_array([3, 6, 8, 9]);
  
  # Call SPVM subroutine
  my $total = SPVM::MyMathNative::sum($sp_nums);
  
  print $total . "\n";

If you know more SPVM Extension, see L&lt;SPVM::Document::Extension&gt;.

If you know the APIs to manipulate SPVM data, see L&lt;SPVM::Document::NativeAPI&gt;.

=head1 DESCRIPTION

SPVM provide Fast Culcuration and Easy way to Bind C/C++ Language to Perl.

=over 4

=item *

B&lt;Fast calculation&gt; - The Perl's biggest weak point is the calculation performance. SPVM provides fast calculations.

=item *

B&lt;GC&gt; - You don't need to care about freeing memory

=item *

B&lt;Static typing&gt; - Static typing for performance

=item *

B&lt;VM&gt; - Byte codes are generated so that you can run them on SPVM language

=item *

B&lt;Perlish syntax&gt; - SPVM syntax is very similar to Perl

=item *

B&lt;Perl module&gt; - SPVM function can be called from Perl itself.

=back

If you learn more SPVM, see L&lt;SPVM&gt; Documentation.

=head1 AUTHOR

Yuki Kimoto E&lt;lt&gt;kimoto.yuki@gmail.com&lt;gt&gt;

=head1 CONTRIBUTERS

=over 4

=item *

L&lt;akinomyoga|https://github.com/akinomyoga&gt; (Koichi Murase)

=item *

L&lt;[NAGAYASU Shinya|https://github.com/nagayasu-shinya&gt;

=item *

L&lt;Reini Urban|https://github.com/rurban&gt;

=item *

L&lt;chromatic|https://github.com/chromatic&gt;

=item *

L&lt;Kazutake Hiramatsu|https://github.com/kazhiramatsu&gt;

=back

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2017 by Yuki Kimoto

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.16.3 or,
at your option, any later version of Perl 5 you may have available.

=cut
</pre></body></html>