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
long syscall0(long n); | |
long syscall1(long n, long a1); | |
long syscall2(long n, long a1, long a2); | |
long syscall3(long n, long a1, long a2, long a3); | |
long syscall4(long n, long a1, long a2, long a3, long a4); | |
long syscall5(long n, long a1, long a2, long a3, long a4, long a5); | |
long syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6); | |
__asm__( | |
".text\n" |
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
{ | |
: printf | |
: print_line | |
} | |
Where | |
Define (printf s) | |
Define (push_static stack h i) |
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
package = expr ("Where" binder*)* | |
expr = NUM ; num | |
expr = STR ; str | |
expr = "True" ; true | |
expr = "False" ; false | |
expr = IDENT ("." IDENT)* ; var | |
expr = "'" IDENT ("." expr)? ; variant | |
expr = OP expr ; prefix_app | |
expr = "[" expr (OP expr)* "]" ; infix |
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
(main) | |
Where | |
Define (main) | |
(option_monad.flat_map | |
; (option_sequence.sequence ['some.1 & 'none & 'some.2 & 'nil]) | |
(option_sequence.sequence ['some.1 & 'some.2 & 'nil]) | |
Func numbers | |
Let {} |
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 <stdio.h> | |
#include <stdlib.h> | |
int yylex(void); | |
void yyerror(const char *s); | |
%} | |
%define api.value.type {int} |
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
;;; Grammar: | |
;;; | |
;;; expr = "True" | |
;;; expr = "False" | |
;;; expr = "(" "And" exprs ")" | |
;;; expr = "(" "Or" exprs ")" | |
;;; | |
;;; exprs = | |
;;; exprs = exprs expr | |
;;; |
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
// | |
// Drawing antialiased lines without using floating point numbers | |
// | |
// Compile: | |
// | |
// $ clang -std=c11 -o line line.c | |
// | |
#include <stdio.h> | |
#include <stdlib.h> |
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
// | |
// Drawing antialiased lines without using floating point numbers | |
// | |
// Compile: | |
// | |
// $ clang -std=c11 -o line line.c | |
// | |
#include <stdio.h> | |
#include <stdlib.h> |
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
Begin { | |
When [OS.argc != 2] { | |
(die "usage: binex n") | |
} | |
Begin Match (Z.read (OS.argv 1)) { | |
| 'nothing | |
(die "usage: binex n") | |
| 'just.n | |
[n -> binex1 -> STDIO.print_line] | |
[n -> binex2 -> STDIO.print_line] |
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
extern P | |
global _start | |
global memcpy | |
global memset | |
global strlen | |
global syscall0 | |
global syscall1 |