This file contains hidden or 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
| ceqexpr <- rule:next | |
| (op:(EQ / PLEQ / MINEQ / MULEQ / DIVEQ / MODEQ / ANDEQ / OREQ / XOREQ / BNEQ / BSREQ / BSLEQ) | |
| t:next | |
| { | |
| if (op->kind == kind(EQ)) rule=repr(node(EQ, rule, t), op); | |
| else if (op->kind == kind(PLEQ)) rule=repr(node(EQ, rule, binop(repr(leaf(PLUS), op), rule, t)), op); | |
| else if (op->kind == kind(MINEQ)) rule=repr(node(EQ, rule, binop(repr(leaf(MINUS), op), rule, t)), op); | |
| else if (op->kind == kind(MULEQ)) rule=repr(node(EQ, rule, binop(repr(leaf(MUL), op), rule, t)), op); | |
| else if (op->kind == kind(DIVEQ)) rule=repr(node(EQ, rule, binop(repr(leaf(DIV), op), rule, t)), op); | |
| else if (op->kind == kind(MODEQ)) rule=repr(node(EQ, rule, binop(repr(leaf(MOD), op), rule, t)), op); |
This file contains hidden or 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
| #!/bin/sh | |
| # Ask python and python3 for their versions, if present. | |
| if test $(which python); then | |
| PYV=$(python -c "import platform;print(platform.python_version())"); | |
| fi | |
| if test $(which python3); then | |
| PY3V=$(python3 -c "import platform;print(platform.python_version())"); | |
| fi |
This file contains hidden or 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
| # USAGE: | |
| # py sr.py <target> <output> (<search> <replace>)* | |
| import sys | |
| def fopen(fname): | |
| with open(fname, 'r') as file: | |
| return file.read() |
This file contains hidden or 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
| #ifndef PL0_PARSER_INCLUDE | |
| #define PL0_PARSER_INCLUDE | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #pragma clang diagnostic push | |
| #pragma clang diagnostic ignored "-Wgnu-label-as-value" | |
| /***********/ | |
| /* Grammar */ |
This file contains hidden or 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
| struct Event { | |
| bool handled; | |
| enum {END, RESIZE, MOUSE, KEY} kind; | |
| union { | |
| struct ResizeEvent { | |
| uint16_t new_width, new_height; | |
| }; | |
| struct MouseEvent { | |
| uint16_t mouse_x, mouse_y; |
This file contains hidden or 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
| /* | |
| fntype <- FNTYPE | |
| LT | |
| argtypes:{ret=list(ARGLIST)} | |
| ( t:type {add(argtypes, t)})? | |
| (COMMA t:type {add(argtypes, t)})* | |
| {if (!argtypes->num_children) add(argtypes, leaf(VOIDTYPE))} | |
| (arrow:ARROW rettype:type)? | |
| GT | |
| {rule=node(FNTYPE, argtypes, rettype!=SUCC ? rettype : leaf(VOIDTYPE))} |
This file contains hidden or 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 <stdio.h> | |
| #include <signal.h> | |
| #include <setjmp.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <pthread.h> | |
| #include <errno.h> | |
| #include <sys/mman.h> |
This file contains hidden or 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
| /* | |
| * The Halting Problem: | |
| * Does there exist an algorithm which can determine if any complete program | |
| * halts? Complete means that all information about the program must be known | |
| * beforehand. | |
| * | |
| * | |
| * The definition in computability theory for "Algorithm" is: | |
| * "A finite list of instructions which when carried out must | |
| * always terminate." |
This file contains hidden or 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 <stdio.h> | |
| #include <stdint.h> | |
| #include <limits.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define ALLOC_SIZE 128 // The size of the object to allocate | |
| #define PAGE_SIZE 4096 // OS page size (almost always 4096) | |
| #define NUM_PAGES 20 // The number of OS pages to reserve. | |
| #define ARENA_SIZE (PAGE_SIZE * NUM_PAGES) // The amout of memory to reserve. |
This file contains hidden or 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 <limits.h> | |
| #include <stdio.h> | |
| #define EN "\x1b[36m" | |
| #define BX "\x1b[31m" | |
| #define RS "\x1b[0m" | |
| #define LT "\x1b[33m" | |
| int main(void) { | |
| puts(BX "======================== ASCII TABLE ========================"); | |
| for (char i = 32;; i++) { |
NewerOlder