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
| bf_([], _, [], _, _, _, _). | |
| bf_([plus | Ops], In, Out, Stack, Cur, Left, Right) :- Val is Cur+1, bf_(Ops, In, Out, Stack, Val, Left, Right). | |
| bf_([minus | Ops], In, Out, Stack, Cur, Left, Right) :- Val is Cur-1, bf_(Ops, In, Out, Stack, Val, Left, Right). | |
| bf_([next | Ops], In, Out, Stack, Cur, Left, []) :- bf_(Ops, In, Out, Stack, 0, [Cur|Left], []). | |
| bf_([next | Ops], In, Out, Stack, Cur, Left, [Next|Right]) :- bf_(Ops, In, Out, Stack, Next, [Cur|Left], Right). | |
| bf_([prev | Ops], In, Out, Stack, Cur, [], Right) :- bf_(Ops, In, Out, Stack, 0, [], [Cur|Right]). | |
| bf_([prev | Ops], In, Out, Stack, Cur, [Next|Left], Right) :- bf_(Ops, In, Out, Stack, Next, Left, [Cur|Right]). | |
| bf_([get | Ops], [], Out, Stack, _, Left, Right) :- bf_(Ops, [], Out, Stack, 0, Left, Right). | |
| bf_([get | Ops], [C|In], Out, Stack, _, Left, Right) :- bf_(Ops, In, Out, Stack, C, Left, Right). | |
| bf_([put | Ops], In, [Cur|Out], Stack, Cur, Left, Right) :- bf_(Ops, In, Out, Stack, Cur, Left, |
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
| uint23_t inner(size_t n, uint32_t *a, uint32_t *b) { | |
| // n:$16 a:$17 b:$18 | |
| uint32_t r = 0; // $0 | |
| while (n != 0) { | |
| n--; | |
| r += (*a)*(*b); | |
| a++; | |
| b++; | |
| } | |
| } |
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
| TESTBENCH = u232c_in_tb u232c_out_tb u232c_byteio_tb | |
| OBJECTS = u232c_in.o u232c_out.o u232c_byteio.o \ | |
| u232c_in_tb.o u232c_out_tb.o u232c_byteio_tb.o \ | |
| byte_processor.o | |
| GHDLC = ghdl | |
| GHDLFLAGS = -fexplicit --ieee=synopsys | |
| GHDL_SIM_OPT = --stop-time=1ms --ieee-asserts=disable | |
| .PHONY: clean |
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
| (* Q1 *) | |
| let rec sum_to n = | |
| match n with | |
| | 0 -> 0 | |
| | n -> n + sum_to (n - 1) | |
| (* Q2*) | |
| let rec fib_exp n = | |
| match n with | |
| | 0 -> 1 |
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
| (define-syntax syntax-rules | |
| (er-macro-transformer | |
| (lambda (expr rename compare) | |
| (let ((ellipsis-specified? (identifier? (cadr expr))) | |
| (count 0) | |
| (_er-macro-transformer (rename 'er-macro-transformer)) | |
| (_lambda (rename 'lambda)) (_let (rename 'let)) | |
| (_begin (rename 'begin)) (_if (rename 'if)) | |
| (_and (rename 'and)) (_or (rename 'or)) | |
| (_eq? (rename 'eq?)) (_equal? (rename 'equal?)) |
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
| ;; このsyntax-rulesが | |
| (syntax-rules () | |
| ((let name ((var init) ...) body ...) | |
| ((lambda () | |
| (define (name var ...) | |
| body ...) | |
| (name init ...)))) | |
| ((let ((var init) ...) body ...) | |
| ((lambda (var ...) body ...) init ...))) |
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
| (er-macro-transformer@176 | |
| (lambda (expr@1459 rename@1460 cmp@1461) | |
| (define (reverse*@1463 l@1462) | |
| ((lambda () | |
| (define loop@1464 | |
| (lambda (r@1465 l@1466) | |
| (if (pair?@6 l@1466) | |
| (loop@1464 | |
| (cons@7 (car@8 l@1466) r@1465) | |
| (cdr@9 l@1466)) |
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
| (define-syntax let-values | |
| (syntax-rules () | |
| ((let-values (binding ...) body0 body1 ...) | |
| (let-values "bind" | |
| (binding ...) () (begin body0 body1 ...))) | |
| ((let-values "bind" () tmps body) | |
| (let tmps body)) | |
| ((let-values "bind" ((b0 e0) | |
| binding ...) tmps body) | |
| (let-values "mktmp" b0 e0 () |
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
| (import (scheme base)) | |
| (import (scheme cxr)) | |
| (import (picrin macro)) | |
| (import (scheme write)) | |
| ;;; utility functions | |
| (define (reverse* l) | |
| ;; (reverse* '(a b c d . e)) => (e d c b . a) | |
| (let loop ((r (car l)) | |
| (l (cdr l))) |
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
| picrin$ cmake . | |
| -- The C compiler identification is GNU 4.8.2 | |
| -- The CXX compiler identification is GNU 4.8.2 | |
| -- Check for working C compiler: /usr/bin/cc | |
| -- Check for working C compiler: /usr/bin/cc -- works | |
| -- Detecting C compiler ABI info | |
| -- Detecting C compiler ABI info - done | |
| -- Check for working CXX compiler: /usr/bin/c++ | |
| -- Check for working CXX compiler: /usr/bin/c++ -- works | |
| -- Detecting CXX compiler ABI info |