repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/subclass_vs_cache.php | tools/phpcb-benchmarks/subclass_vs_cache.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
class FirstParentClass {}
class SecondParentClass {}
class FirstChildClass extends FirstParentClass {}
class SecondChildClass extends SecondParentClass {}
function check_without_cache($className) {
return !is_subclass_of($... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/array_list_dict.php | tools/phpcb-benchmarks/array_list_dict.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\SerialEngine);
function shuffle_assoc(array $array): array {
$keys = array_keys($array);
shuffle($keys);
foreach($keys as $key) {
$new[$key] = $array[$key];
}
return $new;
}
$ar... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/array_pop_check_first.php | tools/phpcb-benchmarks/array_pop_check_first.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\SerialEngine);
$arrayFilled = [1, 2, 3, 4, 5];
$arrayEmpty = [];
// Was the winner.
$bench->addBench(function() use ($arrayEmpty) {
if ($arrayEmpty) {
return array_pop($arrayEmpty);
}... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/string_numbers_engines.php | tools/phpcb-benchmarks/string_numbers_engines.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
$bench->addBench(function() {
$res = [];
$res[] = $x = 123 + 456;
$res[] = $x * 789;
$res[] = $x / 1024;
$res[] = $x - 1024;
$res[] = $x * 123456789;
$res[] = $x * 987654321;
return array_map('intval', $res);
});
... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/empty_bool_vs_array.php | tools/phpcb-benchmarks/empty_bool_vs_array.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
$emptyList = [];
$nonEmptyList = range(1, 100);
$boolTrue = true;
$boolFalse = false;
$bench->addBench(function() use ($emptyList) {
$x = 0;
if ($emptyList) {
$x += 1;
} else {
$x += 1;
}
});
$be... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/if_equality.php | tools/phpcb-benchmarks/if_equality.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\SerialEngine);
// Was the winner.
$bench->addBench(function() {
$c = 0;
$z = null;
if (!$z) {
$c++;
}
});
$bench->addBench(function() {
$c = 0;
$z = null;
if ($z === null) {
... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/key_exists_vs_isset.php | tools/phpcb-benchmarks/key_exists_vs_isset.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
$arr = [...range(50, 500), 'x' => 1, 'y' => 2, 'z' => false, "key" => 1, 'a' => 'b', 'c' => 0];
$arr2 = [...range(50, 500), 'x' => 1, 'y' => 2, 'z' => false, "foo" => 1, 'a' => 'b', 'c' => 0];
$arr3 = [...range(50, 500), 'x... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/string_concat_extrapolate.php | tools/phpcb-benchmarks/string_concat_extrapolate.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
define('SOME_CONST', md5(random_bytes(100)));
class Something {
public function method(): string {
return md5('whatever');
}
}
$obj = new Something;
$bench->addBench(function() use ($obj) {
return SOME_CONST . '.' . ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/ifs_just_ifs.php | tools/phpcb-benchmarks/ifs_just_ifs.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\SerialEngine);
const FLAG_C_BOOL = true;
define('FLAG_A_INT', 1);
define('FLAG_B_BOOL', true);
abstract class Flagger {
public static $flagAInt = 1;
public static $flagBBool = true;
}
$bench->addBench(... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/fn_vs_static_method.php | tools/phpcb-benchmarks/fn_vs_static_method.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
class SomeClass {
static function doStuff($a, $b, $c = null) {
$x = $a . $b . $c;
if ($x[0] == $a) {
$x = strrev($x);
}
return $x;
}
}
function do_stuff($a, $b, $c = null) {
$x = $a . $b . $c;
if ($x[0] == ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/numeric_int.php | tools/phpcb-benchmarks/numeric_int.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark;
$data = [false, '+1', '-1', +1, 0, 1, 42, -1024, 0.2, -0.2, -0.7, 0.7, true, "ahoj", "0.1", "-4.2", "-4.7", "-1000000", "false", "75", "125"];
$bench->addBench(function() use ($data) {
$result = [];
foreach ($data as $x) ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/if_vs_switch.php | tools/phpcb-benchmarks/if_vs_switch.php | <?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\ChaoticEngine);
const VALUES = [100, false, true, "ahoj", 0, "damn"];
function testA() {
$val = VALUES[array_rand(VALUES)];
if ($val === 100) {
$x = 1;
} elseif ($val === false) {
$x = 1;
} elseif ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/if_true_equality.php | tools/phpcb-benchmarks/if_true_equality.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\ChaoticEngine);
$bench->addBench(function() {
$c = 0;
$bool = true;
if ($bool) {
$c++;
}
});
$bench->addBench(function() {
$c = 0;
$bool = true;
if ($bool === true) {
$c++;
}
}... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/phpcb-benchmarks/array_iterate_keys.php | tools/phpcb-benchmarks/array_iterate_keys.php | #!/usr/bin/env php
<?php
require __DIR__ . "/../../vendor/autoload.php";
$bench = new \Smuuf\Phpcb\PhpBenchmark(new \Smuuf\Phpcb\SerialEngine);
$hugeArr = array_fill(0, 1_000_000, false);
$bigArr = array_fill(0, 100_000, false);
$smallArr = array_fill(0, 100, false);
$bench->addBench(function() use ($smallArr) {
$... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/build-phar/run.php | tools/build-phar/run.php | #!/usr/bin/env php
<?php
use \Smuuf\Primi\Helpers\Colors;
if (!extension_loaded('phar')) {
die("Cannot create Phar files. Phar extension not enabled");
}
if (!\Phar::canWrite()) {
die("Cannot create Phar files: 'phar.readonly' must be set to 0");
}
// Composer's autoload.
require __DIR__ . '/../../vendor/autoload... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/tools/docgen/docgen.php | tools/docgen/docgen.php | #!/usr/bin/env php
<?php
declare(strict_types=1);
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Helpers\Colors;
define('PRIMI_ROOT_DIT', realpath(__DIR__ . '/../..'));
// Composer's autoload.
require PRIMI_ROOT_DIT . '/vendor/autoload.php';
// Strict errors.
error_reporting(E_AL... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/DirectInterpreter.php | src/DirectInterpreter.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Ex\SystemException;
use \Smuuf\Primi\Ex\ControlFlowException;
use \Smuuf\Primi\Code\Ast;
use \Smuuf\Primi\Tasks\Emitters\PosixSignalTaskEmitter;
use \Smuuf\Primi\Values\AbstractValue;
use... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/EnvInfo.php | src/EnvInfo.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\Primi\Ex\EngineError;
/**
* Static helper for providing information about current runtime environment.
*/
abstract class EnvInfo {
private static bool $bootCheck = \false;
private static ?bool $runningInPhar = \null;
private static ?bool $runnin... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Context.php | src/Context.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Scope;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Code\AstProvider;
use \Smuuf\Primi\Ex\EngineInternalError;
use \Smuuf\Primi\Tasks\TaskQueue;
use \Smuuf\Primi\Values\ModuleValue;
use \Smuuf\Primi\Values\AbstractV... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Repl.php | src/Repl.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Scope;
use \Smuuf\Primi\Ex\ErrorException;
use \Smuuf\Primi\Ex\EngineException;
use \Smuuf\Primi\Ex\SystemException;
use \Smuuf\Primi\Cli\Term;
use \Smuuf\Primi\Code\Source;
use \Smuuf\Primi\Parser\GrammarHelpers;
use \Sm... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/InterpreterResult.php | src/InterpreterResult.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Scope;
/**
* Object wrapping a single interpreter execution result.
*/
class InterpreterResult {
use StrictObject;
public function __construct(
private Scope $scope,
private Context $context,
) {}
public fun... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Interpreter.php | src/Interpreter.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Scope;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Code\Source;
use \Smuuf\Primi\Code\SourceFile;
use \Smuuf\Primi\Values\ModuleValue;
use \Smuuf\Primi\Helpers\Wrappers\ContextPushPopWrapper;
/**
* Primi's primary... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Location.php | src/Location.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\Primi\Helpers\Colors;
use \Smuuf\StrictObject;
class Location {
use StrictObject;
/** Name of the location (e.g. module name or source ID). */
private string $name;
/** Line in the file. */
private int $line;
/** Position on the line, if spe... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Config.php | src/Config.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Drivers\VoidIoDriver;
use \Smuuf\Primi\Drivers\TerminalIoDriver;
use \Smuuf\Primi\Drivers\StdIoDriverInterface;
class Config {
use StrictObject;
private... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/MagicStrings.php | src/MagicStrings.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
abstract class MagicStrings {
public const MODULE_MAIN_NAME = '__main__';
public const ATTR_NAME = '__name__';
public const TYPE_OBJECT = 'object';
public const MAGICMETHOD_NEW = '__new__';
public const MAGICMETHOD_INIT = '__init__';
public const MAGICME... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Scope.php | src/Scope.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\StrictObject;
/**
* A structure for representing a variable scope - storage for variables.
*/
class Scope {
use StrictObject;
/**
* Flag for standard, ordinary scopes.
*/
public const TYPE_STANDARD = ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/StackFrame.php | src/StackFrame.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\Primi\Helpers\Colors;
use \Smuuf\Primi\Values\ModuleValue;
use \Smuuf\StrictObject;
class StackFrame {
use StrictObject;
/** Name of the function call (often the name of the called function). */
private string $name;
/**
* Module the stack f... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Logger.php | src/Logger.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\Primi\Cli\Term;
use \Smuuf\StrictObject;
abstract class Logger {
use StrictObject;
private static bool $enabled = \false;
public static function enable(bool $state = \true): void {
self::$enabled = $state;
}
public static function debug(str... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/ContextServices.php | src/ContextServices.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Code\AstProvider;
use \Smuuf\Primi\Tasks\TaskQueue;
use \Smuuf\Primi\Modules\Importer;
/**
* Service provider for specific context instances.
*/
class ContextServices {
use StrictObject;
private TaskQueue $taskQueu... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/EngineInternalError.php | src/Ex/EngineInternalError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
/**
* Errors that represent some malfunction in Primi interpreter engine. These
* should not happen - and if they do, it means that Primi itself contains an
* error (some kind of unhandled edge-case, for example).
*/
class EngineInternalError extends Engin... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/TypeError.php | src/Ex/TypeError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class TypeError extends RuntimeError {
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/SyntaxError.php | src/Ex/SyntaxError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
use \Smuuf\Primi\Location;
use \Smuuf\Primi\Code\Source;
use \Smuuf\Primi\Helpers\StringEscaping;
class SyntaxError extends ErrorException {
public function __construct(
Location $location,
?string $excerpt = \null,
?string $reason = \null
) {
$sa... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ImportRelativeWithoutParentException.php | src/Ex/ImportRelativeWithoutParentException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ImportRelativeWithoutParentException extends EngineException {
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/UndefinedVariableError.php | src/Ex/UndefinedVariableError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class UndefinedVariableError extends LookupError {
public function __construct(string $msg) {
parent::__construct("Undefined variable '$msg'");
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/InternalPostProcessSyntaxError.php | src/Ex/InternalPostProcessSyntaxError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
/**
* Post-process internal syntax error exception that can be thrown by any
* kind of node handler's "::reduce()" method.
* @internal
*/
class InternalPostProcessSyntaxError extends EngineException {
/** Specific reason of the syntax error, if specified... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ControlFlowException.php | src/Ex/ControlFlowException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
abstract class ControlFlowException extends EngineException {
/**
* Statement causing such control flow mechanism. This is a default value
* and ultimately shouldn't appear anywhere, as it should always be
* overridden in child classes.
*
* @const ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ImportBeyondTopException.php | src/Ex/ImportBeyondTopException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ImportBeyondTopException extends EngineException {
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/KeyError.php | src/Ex/KeyError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class KeyError extends LookupError {
public function __construct(string $key) {
parent::__construct("Undefined key $key");
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/SystemException.php | src/Ex/SystemException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class SystemException extends BaseException {
// System exception (raised, for example, when SIGINT is sent via CTRL+C).
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ContinueException.php | src/Ex/ContinueException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ContinueException extends ControlFlowException {
public const ID = 'continue';
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/EngineError.php | src/Ex/EngineError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
/**
* Errors that represent runtime errors within the engine, but which might
* not be necessarily caused by faulty logic in the engine itself. It may be
* that someone is using Primi in some unexpected or just plainly wrong way.
*/
class EngineError exten... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/VariableImportError.php | src/Ex/VariableImportError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class VariableImportError extends ImportError {
public function __construct(string $symbol, string $dotpath) {
parent::__construct("Variable '{$symbol}' not found in module '{$dotpath}'");
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/EngineException.php | src/Ex/EngineException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class EngineException extends BaseException {
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/BaseException.php | src/Ex/BaseException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
abstract class BaseException extends \Exception {
use \Smuuf\StrictObject;
// All exceptions thrown by Primi will extend this base exception class.
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/LookupError.php | src/Ex/LookupError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class LookupError extends RuntimeError {
// Base class for lookup (variables/indexes/keys) errors.
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/BreakException.php | src/Ex/BreakException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class BreakException extends ControlFlowException {
public const ID = 'break';
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/RuntimeError.php | src/Ex/RuntimeError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class RuntimeError extends ErrorException {
public function __construct(string $msg) {
$this->message = $msg;
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/IndexError.php | src/Ex/IndexError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class IndexError extends LookupError {
public function __construct(int $index) {
parent::__construct("Undefined index $index");
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/UnhashableTypeException.php | src/Ex/UnhashableTypeException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class UnhashableTypeException extends EngineException {
/** @var string Type name. */
protected $type;
public function __construct(string $type) {
parent::__construct("Unhashable type '$type'");
$this->type = $type;
}
public function getType(): str... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/InternalSyntaxError.php | src/Ex/InternalSyntaxError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
/**
* Internal syntax error exception thrown by the parser, which operates on a
* raw string, without any knowledge about a specific source code or
* module/file.
*
* This internal syntax error should be caught and converted to a proper syntax
* error re... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ImportError.php | src/Ex/ImportError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ImportError extends RuntimeError {
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/BinaryOperationError.php | src/Ex/BinaryOperationError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
use \Smuuf\Primi\Values\AbstractValue;
class BinaryOperationError extends RuntimeError {
public function __construct(
string $op,
AbstractValue $left,
AbstractValue $right
) {
$msg = \sprintf(
"Cannot use operator '%s' with '%s' and '%s'",
$... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/RelationError.php | src/Ex/RelationError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
use \Smuuf\Primi\Values\AbstractValue;
class RelationError extends RuntimeError {
public function __construct(string $op, AbstractValue $left, AbstractValue $right) {
$lType = $left->getTypeName();
$rType = $right->getTypeName();
$msg = "Undefined re... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ArgumentCountError.php | src/Ex/ArgumentCountError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ArgumentCountError extends RuntimeError {
protected int $passed;
protected int $expected;
public function __construct(
int $passed,
int $expected
) {
$this->passed = $passed;
$this->expected = $expected;
parent::__construct($this->build... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ErrorException.php | src/Ex/ErrorException.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
use \Smuuf\Primi\Location;
use \Smuuf\Primi\StackFrame;
use \Smuuf\Primi\Helpers\Func;
/**
* All errors that Primi knows will extend this base error exception class.
* When thrown, information about location of the error must be known and
* passed into thi... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/ModuleNotFoundError.php | src/Ex/ModuleNotFoundError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class ModuleNotFoundError extends ImportError {
public function __construct(string $symbol) {
parent::__construct("Module '{$symbol}' not found");
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Ex/CircularImportError.php | src/Ex/CircularImportError.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Ex;
class CircularImportError extends ImportError {
/**
* @param string $nextModule Name of the module causing circular
* import.
*/
public function __construct(string $nextModule) {
parent::__construct("Circular import when importing: {$nextModule}");
... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/NumberValue.php | src/Values/NumberValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Func;
/**
* NOTE: You should not instantiate this PHP class directly - use the helper
* `Interned::number()` factory to get these.
*
* NOTE: You should _n... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/TypeValue.php | src/Values/TypeValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Location;
use \Smuuf\Primi\MagicStrings;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Values\AbstractBuiltinValue;
use \Smuuf\Prim... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/FuncValue.php | src/Values/FuncValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Helpers\Interned;
use \Smuuf\Primi\Location;
use \Smuuf\Primi\MagicStrings;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Structures\CallArgs;
use \Smuuf\Primi\Structures\FnContainer;
/**
* @property Fn... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/DictValue.php | src/Values/DictValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\KeyError;
use \Smuuf\Primi\Ex\TypeError;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Ex\UnhashableTypeException;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Structures\MapContainer;
/**
... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/NotImplementedValue.php | src/Values/NotImplementedValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Values\AbstractValue;
/**
* Special constant object representing a "not implemented" information usable
* in userland.
*/
class NotImplementedValue extends AbstractBuiltinValue {
public const TYP... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/AbstractValue.php | src/Values/AbstractValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Location;
use \Smuuf\Primi\Ex\TypeError;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Ex\UnhashableTypeException;
use \Smuuf\Primi\Values\TypeValue;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Typ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/ModuleValue.php | src/Values/ModuleValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Scope;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
/**
* @property Scope|null $value Global scope of the module or null, if
* the module has no global scope (which is handy for "anonymous" modules that
* wrap Primi functions that are wrapper... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/BuiltinTypeValue.php | src/Values/BuiltinTypeValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
/**
* Sometimes Primi engine needs to differentiate between:
* 1) Builtin global and immutable Primi types are at the core of Primi
* engine.
* 2) All other Primi types (either implemented in PHP or created in Primi
* userland).
*
* Therefore all Pr... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/BoolValue.php | src/Values/BoolValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Values\NumberValue;
/**
* NOTE: You should not instantiate this PHP class directly - use the helper
* `Interned::bool()` factory to get these.
*/
class BoolValue extends AbstractBuiltinValue {
pu... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/MethodValue.php | src/Values/MethodValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Structures\CallArgs;
use \Smuuf\Primi\Structures\FnContainer;
/**
* NOTE: Although this PHP class extends from `FuncValue`, in Primi runtime
* the `MethodType` doesn... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/ListValue.php | src/Values/ListValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Indices;
class ListValue extends AbstractBuiltinValue {
public const TYPE = "list";
/**
* @param array<AbstractValue> $it... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/InstanceValue.php | src/Values/InstanceValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\MagicStrings;
use \Smuuf\Primi\Values\TypeValue;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Interned;
use \Smuuf\Primi\Structures\CallArgs;
/**
* Class for representing instances of userland classes... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/NullValue.php | src/Values/NullValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Values\AbstractValue;
/**
* NOTE: You should not instantiate this PHP class directly - use the helper
* `Interned::null()` factory to get these.
*/
class NullValue extends AbstractBuiltinValue {
... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/StringValue.php | src/Values/StringValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\TypeError;
use \Smuuf\Primi\Ex\IndexError;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Types;
use \Smuuf\Primi\Helpers\StringEscaping;
/**
* NOTE: You... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/RegexValue.php | src/Values/RegexValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Types;
/**
* NOTE: You should not instantiate this PHP class directly - use the helper
* `Interned::regex()` factory to get these.
*/
class RegexValue extends AbstractBuiltinValue {
publi... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/AbstractBuiltinValue.php | src/Values/AbstractBuiltinValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
/**
* Base PHP class for representing all Primi values/object builtin into the
* engine.
*/
abstract class AbstractBuiltinValue extends AbstractValue {
public function getTypeName(): string {
return static::TYPE;
}
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/TupleValue.php | src/Values/TupleValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Indices;
/**
* @property array<AbstractValue> $value Internal tuple container.
*/
class TupleValue extends AbstractBuiltinVal... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Values/IteratorFactoryValue.php | src/Values/IteratorFactoryValue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Values;
use \Smuuf\Primi\Stdlib\BuiltinTypes;
/**
* Class for representing dynamically created Primi iterables.
*
* For example, we want "range()" function (implemented in PHP) to return
* not only a one-time iterator, but an iterable that allows multiple use... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Func.php | src/Helpers/Func.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\StackFrame;
use \Smuuf\Primi\Ex\TypeError;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Ex\BaseException;
use \Smuuf\Primi\Parser\GrammarHelpers;
use \Smuuf\Primi\Values\StringValue;
use \Smuuf\Primi\Values\... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/StringEscaping.php | src/Helpers/StringEscaping.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\StrictObject;
class StringEscaping {
use StrictObject;
/**
* Escape sequences that are supported in string literals.
*
* Left side represents character after a backslash which together form a
* sup... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Indices.php | src/Helpers/Indices.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Ex\IndexError;
use \Smuuf\Primi\Values\AbstractValue;
/**
* Helpers for handling accessing PHP arrays via possibly negative indices.
*/
abstract class Indices {
/**
* Translate negative index to positive index that's a valid index ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Stats.php | src/Helpers/Stats.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Cli\Term;
use \Smuuf\StrictObject;
/**
* A static runtime statistics gatherer.
*/
abstract class Stats {
use StrictObject;
/** @var float Point in time when stats gathering was enabled. */
private static float $startTime = 0;
/*... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Types.php | src/Helpers/Types.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\MagicStrings;
use \Smuuf\Primi\Ex\EngineError;
use \Smuuf\Primi\Values\FuncValue;
use \Smuuf\Primi\Values\TypeValue;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Values\NullValue;
use \Smuuf\Primi\Stru... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/ComparisonLTR.php | src/Helpers/ComparisonLTR.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Ex\RelationError;
use \Smuuf\Primi\Ex\EngineInternalError;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Handlers\HandlerFactory;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\StrictObject;
class Comparis... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Timer.php | src/Helpers/Timer.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\StrictObject;
class Timer {
use StrictObject;
/** @var float|null Point in time where timer started. */
private $time = \null;
/**
* Start the timer (set a point in time to measure from).
*/
public function start(): self {
$this... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/ArithmeticLTR.php | src/Helpers/ArithmeticLTR.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Ex\BinaryOperationError;
use \Smuuf\Primi\Handlers\HandlerFactory;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\Primi\Helpers\Interned;
use \Smuuf\StrictObject;
class Arithme... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Interned.php | src/Helpers/Interned.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Values\BoolValue;
use \Smuuf\Primi\Values\NullValue;
use \Smuuf\Primi\Values\BytesValue;
use \Smuuf\Primi\Values\RegexValue;
use \Smuuf\Primi\Values\NumberValue;
use \Smuuf\Primi\Values\StringValue;
use \Smuuf\Primi\Values\NotImplementedV... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/ValueFriends.php | src/Helpers/ValueFriends.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Values\AbstractValue;
/**
* Emulate friend visibility - extending classes can access internal `$value`
* property of `AbstractValue` class.
*
* AbstractValue and Extension classes use this.
*
* This way bot... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Colors.php | src/Helpers/Colors.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\StrictObject;
abstract class Colors {
use StrictObject;
const COLOR_FORMAT = "\033[%sm";
const COLORS = [
// Reset.
'_' => '0',
// Fore.
'black' => '0;30',
'darkgrey' => '1;30',
'darkgray' => '1;30',
'blue' => '0;34',
'l... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/TypeResolver.php | src/Helpers/TypeResolver.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers;
use \Smuuf\Primi\Ex\EngineInternalError;
use \Smuuf\Primi\Values\TypeValue;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Values\InstanceValue;
abstract class TypeResolver {
/**
* Some classes used for representing Primi objects have "unfri... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Traits/WatchLifecycle.php | src/Helpers/Traits/WatchLifecycle.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\Traits;
use \Smuuf\Primi\Helpers\Func;
/**
* Use external scope for watching life-cycles, as different classes that
* use the WatchLifecycle trait don't share the one trait's static properties.
*/
abstract class WatchLifecycleScope {
public static in... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Wrappers/AbstractWrapper.php | src/Helpers/Wrappers/AbstractWrapper.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\Wrappers;
/**
* A "wrapper" control structure emulating Python's context manager behavior.
* This is to provide easy-to-use resource management (so you don't forget
* anything important after doing something).
*
* For details about context managers in... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Wrappers/ContextPushPopWrapper.php | src/Helpers/Wrappers/ContextPushPopWrapper.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\Wrappers;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\StackFrame;
use \Smuuf\Primi\Scope;
/**
* @internal
*/
class ContextPushPopWrapper extends AbstractWrapper {
use StrictObject;
private Context $ctx;
/** Call frame to pu... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Wrappers/CatchPosixSignalsWrapper.php | src/Helpers/Wrappers/CatchPosixSignalsWrapper.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\Wrappers;
use \Smuuf\Primi\Tasks\TaskQueue;
use \Smuuf\Primi\Tasks\Emitters\PosixSignalTaskEmitter;
class CatchPosixSignalsWrapper extends AbstractWrapper {
/**
* Dictionary for tracking how many times this wrapper registered some
* specific task qu... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/Wrappers/ImportStackWrapper.php | src/Helpers/Wrappers/ImportStackWrapper.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\Wrappers;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Ex\CircularImportError;
use \Smuuf\Primi\Modules\Importer;
class ImportStackWrapper extends AbstractWrapper {
use StrictObject;
/** Importer instance. */
private Importer $importer;
/** Import ID ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/CallConventions/PhpCallConvention.php | src/Helpers/CallConventions/PhpCallConvention.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\CallConventions;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Ex\TypeError;
use \Smuuf\Primi\Ex\RuntimeError;
use \Smuuf\Primi\Ex\ArgumentCountError;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Helpers\Types;
use \Smuuf\P... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/CallConventions/CallArgsCallConvention.php | src/Helpers/CallConventions/CallArgsCallConvention.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\CallConventions;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Structures\CallArgs;
/**
* Call convention for invoking PHP callables from within Primi code/engine.
*
* This convention passes ... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Helpers/CallConventions/CallConventionInterface.php | src/Helpers/CallConventions/CallConventionInterface.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Helpers\CallConventions;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Values\AbstractValue;
use \Smuuf\Primi\Structures\CallArgs;
interface CallConventionInterface {
public function call(CallArgs $args, Context $ctx): ?AbstractValue;
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Tasks/TaskInterface.php | src/Tasks/TaskInterface.php | <?php
namespace Smuuf\Primi\Tasks;
use \Smuuf\Primi\Context;
interface TaskInterface {
public function execute(Context $ctx): void;
}
| php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Tasks/TaskQueue.php | src/Tasks/TaskQueue.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Tasks;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Helpers\Func;
use \Smuuf\StrictObject;
class TaskQueue {
use StrictObject;
private Context $context;
/** Run queued tasks after this time interval passes (in seconds). */
public static float $interval = 0.2... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Tasks/Types/PosixSignalTask.php | src/Tasks/Types/PosixSignalTask.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Tasks\Types;
use \Smuuf\Primi\Repl;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Ex\EngineInternalError;
use \Smuuf\Primi\Ex\SystemException;
use \Smuuf\Primi\Tasks\TaskInterface;
use \Smuuf\StrictObject;
class PosixSignalTask implements TaskInterface {
use Stric... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Tasks/Types/CallbackTask.php | src/Tasks/Types/CallbackTask.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Tasks\Types;
use \Smuuf\StrictObject;
use \Smuuf\Primi\Context;
use \Smuuf\Primi\Structures\CallArgs;
use \Smuuf\Primi\Tasks\TaskInterface;
use \Smuuf\Primi\Values\FuncValue;
class CallbackTask implements TaskInterface {
use StrictObject;
/** The callback fun... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
smuuf/primi | https://github.com/smuuf/primi/blob/d66ad6a397080a4caec9b634c925c0e085a00bb0/src/Tasks/Emitters/PosixSignalTaskEmitter.php | src/Tasks/Emitters/PosixSignalTaskEmitter.php | <?php
declare(strict_types=1);
namespace Smuuf\Primi\Tasks\Emitters;
use \Smuuf\Primi\Ex\EngineInternalError;
use \Smuuf\Primi\Tasks\TaskQueue;
use \Smuuf\Primi\Tasks\Types\PosixSignalTask;
abstract class PosixSignalTaskEmitter {
/**
* A list of signals that have been registered into `pcntl_signal`
* and it i... | php | MIT | d66ad6a397080a4caec9b634c925c0e085a00bb0 | 2026-01-05T05:19:57.676815Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.