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
#!/usr/bin/env python3 | |
#-*-coding:utf-8-*- | |
# License: GPLv3 | |
import functools | |
import math | |
import re | |
line_width = 40 | |
#input_text = "aaa bb cc ddddd" |
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
<html> | |
<!-- | |
這是示範「如何在某個 HTML parts 的第幾個字插入字串(或是 HTML 標籤的範例)」 | |
License : Public Domain | |
--> | |
<head> | |
<title>test for input string</title> | |
</head> | |
<body> | |
<div id="test">台灣 ê siaⁿ-im,tī<b> 佗位? Lorem <i>ipsum</i></b><i> dolor sit</i> amet, inis me Johano agus mar sin de.</div> |
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> | |
/* | |
lambda 函數的案例 | |
(define foo (lambda (x) 10) [fv ()]) | |
(foo foo) | |
*/ | |
typedef union object object; |
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
#lang racket | |
(define expr | |
'(+ (- 5 (* 4 3)) (* 7 (* 2 8)))) | |
(struct exp-and-holder (exp holder) #:transparent) | |
(define (main-converter exp) | |
(let* | |
((var-holder '()) | |
(exp-holder (exp-and-holder exp var-holder))) |
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
#!/usr/bin/env/python3 | |
# Authur: Yoxem | |
# License: Public Domain | |
code = [["MOV", 12 ,"GEN1"], ["MOV", "GEN1", ["GEN2", 6]], ["ADD", "GEN1", 12], ["ADD", "GEN1", "GEN2"]] | |
memory = [0] * 20; | |
registers = { | |
'GEN1' : 0, |
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
#lang racket | |
;; find-free-var.rkt free variable finder. Nacessesary while closure conversion is operated. | |
;; ref: the algorithm from Definition 1.4.1, Type Theory andd Formal Proof: An Introdution | |
;; remove items from a list | |
(define (remove-items items list) | |
(if (eq? items empty) | |
list | |
(remove-items (cdr items) (remove (car items) list))) | |
) |
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
#lang racket | |
; pattern-match.rkt - implementation of basic pattern match | |
(define (conbining-cond-and-match-list ls) | |
(cons 'cond ls)) | |
(define (convert-match input) | |
(define pattern-list (cddr input)) | |
(cond | |
[(not (eq? (car input) 'match)) (error "the head of input is not \"match\". Exit.")] |
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
#lang racket | |
(define (combine-two-list x y) | |
(if (eq? x '()) '() | |
(cons (cons (car x) (car y)) (combine-two-list (cdr x) (cdr y))))) | |
; (combine-two-list '(a b c) '(1 2 3)) -> '((a . 1) (b . 2) (c . 3)) | |
(define (walk-the-tree expr-tree macro-var-list) | |
(cond | |
((pair? expr-tree) (cons (walk-the-tree (car expr-tree) macro-var-list) |
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
import re | |
# test code | |
# test = "1 + 2 * (23 / 12)" | |
test1 = "(123 (88) 1) 9(8 7) " | |
test2 = ''' | |
12 | |
(+ 2 3) | |
(let (int x) 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
-test.mim | |
;; zh-pinyin.mim -- Input method for Chinese Pinyin characters | |
;; Copyright (C) 2004, 2005 | |
;; National Institute of Advanced Industrial Science and Technology (AIST) | |
;; Registration Number H15PRO112 | |
;; This file is part of the m17n database; a sub-part of the m17n | |
;; library. | |
;; The m17n library is free software; you can redistribute it and/or |
NewerOlder