This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
require __DIR__ . '/vendor/autoload.php'; | |
$context = new PHPCompiler\Bootstrap\Context; | |
$parser = new PHPCompiler\Bootstrap\Parser($context); | |
$parser->parse(file_get_contents(__DIR__ . "/example.php"), __FILE__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hex Dec Binary | |
A = A0 160 10100000 | |
B = 4C 76 01001100 | |
0 - A | |
FFFFFF60 -160 1111111101100000 (lowest 16 bits) | |
0 - A - B | |
FFFFFF20 -236 1111111100010100 (lowest 16 bits) | |
Lowest 8 bits of 0-A-B: 00010100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTUAL[0000] CASE[10100001 10000010 01001101 11111111 10010001] XOR[0000] ~XOR[1111] SUM[0000] REVSUM[101110] -REVSUM[0010] | |
ACTUAL[0000] CASE[10100001 10000010 01001101 11111111 10000001] XOR[0000] ~XOR[1111] SUM[0000] REVSUM[101110] -REVSUM[0010] | |
ACTUAL[0000] CASE[10100001 11000010 01001100 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1101] REVSUM[101101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10000010 01001100 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1101] REVSUM[101101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10100011 01001101 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1111] REVSUM[111101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10010011 01001101 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1111] REVSUM[111101] -REVSUM[0011] | |
ACTUAL[0001] CASE[10100001 10100011 01001100 11111111 11111111] XOR[1110] ~XOR[0001] SUM[1110] REVSUM[110101] -REVSUM[1011] | |
ACTUAL[0001] CASE[10100001 11000010 01001101 11111111 11111111] XOR[1110] ~XOR[0001] SUM[1110] REVSUM[110101] -REVSUM[1011] | |
ACTUAL[0001] CASE[10100001 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Toggle Swing: 10100010 00000001 | |
Toggle LED: 10100010 00001000 | |
Set Temp + Mode | |
Byte 1: 10100001 | |
Byte 2: | |
|--------|--------|--------|--------|--------|--------|--------|--------| | |
| POWER | SLEEP | Fan 0 | Fan 1 | FAN 2 | MODE 0 | MODE 1 | MODE 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Lock { | |
public function advisory(string $identifier): LockContext; | |
public function exclusive(string $identifier): LockContext; | |
public function waitForAdvisory(string $identifier, int $timeout = 0): \Generator; | |
public function waitForExclusive(string $identifier, int $timeout = 0): \Generator; | |
} | |
interface LockContext { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use ReckiCT\Jit; | |
if (function_exists('class_alias')) { | |
// HippyVM doesn't have a class_alias, so this will break things. | |
require __DIR__ . '/../vendor/autoload.php'; | |
} | |
define("IM", 139968); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CollectionMonad extends Monad { | |
public function __construct(array $value) { | |
$this->value = $value; | |
} | |
public function bind($callback) { | |
$newValues = array(); | |
foreach ($this->value as $value) { | |
$newValues[] = $this->callCallback($callback, $value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fibo(int $n): int { | |
return match($n) { | |
case 1: 1; | |
case 0: 1; | |
case _<0: throw new Exception("Less than 0 is not allowed, " . _ . " provided"); | |
case _: fibo(_ - 1) + fibo(_ - 2); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pins_arduino.h" | |
#include "SPI_USART.h" | |
uint8_t SPIUsartClass::ss[SPIUSART_COUNT]; | |
void SPIUsartClass::begin(uint8_t _usart, uint8_t _ss) { | |
if (_usart > SPIUSART_COUNT) { | |
return; | |
} | |
ss[_usart] = _ss; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.offset 0xC000 | |
boot: | |
MOV RJ1, 0x00; | |
MOV RJ2, 0x00; | |
MOV RA, 0xD0; | |
STORE RA; | |
MOV RJ2, 0x01; | |
MOV RA, 0x00; | |
STORE RA; |