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
// === Tokenizer | |
class Tokens { | |
constructor(tokens) { | |
this.head = tokens[0]; | |
this.tail = tokens.slice(1); | |
} | |
} | |
class Tokenizer { |
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
s="print('quine')";v="s=v=l=p=";l='";\'\\';p="print(v[0,2]+l[0]+s+l[0,2]+v[2,2]+l[0]+v+l[0]+l[1]+v[4,2]+l[2]+l[0,2]+l[3]+l[2]+l[3]+l[3]+l[2]+l[1]+v[6,2]+l[0]+p+l[0]+l[1]+p)";print(v[0,2]+l[0]+s+l[0,2]+v[2,2]+l[0]+v+l[0]+l[1]+v[4,2]+l[2]+l[0,2]+l[3]+l[2]+l[3]+l[3]+l[2]+l[1]+v[6,2]+l[0]+p+l[0]+l[1]+p) |
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
val s="print(\"quine\")";val v="val s=val v=val c=val p=";val c="\\\";";val p="print(v.slice(0,6)+c(1)+s.slice(0,6)+c.slice(0,2)+s.slice(7,12)+c.slice(0,2)+s.last+c.slice(1,3)+v.slice(6,12)+c(1)+v+c.slice(1,3)+v.slice(12, 18)+c(1)+c(0)+c(0)+c(0)+c.slice(1,3)+c.slice(1,3)+v.slice(18, 24)+c(1)+p+c.slice(1,3)+p)";print(v.slice(0,6)+c(1)+s.slice(0,6)+c.slice(0,2)+s.slice(7,12)+c.slice(0,2)+s.last+c.slice(1,3)+v.slice(6,12)+c(1)+v+c.slice(1,3)+v.slice(12, 18)+c(1)+c(0)+c(0)+c(0)+c.slice(1,3)+c.slice(1,3)+v.slice(18, 24)+c(1)+p+c.slice(1,3)+p) |
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 static java.lang.System.out; | |
public class Quine{ | |
public static void main(String[] args){ | |
String h="import static java.lang.System.out;\npublic class Quine{\n public static void main(String[] args){\n"; | |
String d="String h=String d=String s=String c="; | |
String s="\"\\n;} "; | |
String c=" out.println(h+s.substring(5)+d.substring(0,9)+s.charAt(0)+(h.substring(0,35)+s.substring(1,3))+h.substring(36,55)+s.substring(1,3)+h.substring(56,97)+s.substring(1,3)+s.charAt(0)+s.charAt(3));out.println(s.substring(5)+d.substring(9,18)+s.charAt(0)+d+s.charAt(0)+s.charAt(3));out.println(s.substring(5)+d.substring(18,27)+s.charAt(0)+s.charAt(1)+s.charAt(0)+s.charAt(1)+s.charAt(1)+s.substring(2)+s.charAt(0)+s.charAt(3));out.println(s.substring(5)+d.substring(27)+s.charAt(0)+c+s.charAt(0)+s.charAt(3)); out.println(c+s.substring(7)+s.charAt(4)+s.charAt(4));"; | |
out.println(h+s.substring(5)+d.substring(0,9)+s.charAt(0)+h.substring(0,35)+s.substring(1,3)+h.substring(36,55)+s.substring(1,3)+h.substring |
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
'''碎形數列之一…每隔 n 個空格填入數字1、2、3、4、5 ....,例如 n 為 2 時… | |
1 _ _ 2 _ _ 3 _ _ 4 _ _ 5 _ _ 6 _ _ 7 _ _ 8 _ _ 9 _ _ .... | |
接著,在上面的數列中,每隔 2 個空格填入數字1、2、3、4、5 .... | |
1 1 _ 2 _ 2 3 _ _ 4 3 _ 5 _ 4 6 _ _ 7 5 _ 8 _ 6 9 _ _ .... | |
繼續在上面的數列中,每隔 2 個空格填入數字1、2、3、4、5 .... |
The Example of JavaScript Essence: Writing A DOM Library
(function(global) {
var XD = function(selector, container) {
return new XD.mth.init(selector, container);
};
var utils = {
trim: function(text) {
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
;; 說明:https://openhome.cc/Gossip/WebAssembly/Array.html | |
(module | |
(import "env" "log" (func $log (param i32))) | |
(memory 1) | |
;; 建立新陣列 | |
(func $arr (param $len i32) (result i32) | |
(local $offset i32) ;; 記錄陣列偏移量 | |
(set_local $offset (i32.load (i32.const 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
class Num: | |
def __init__(self, value): | |
self.value = value | |
def evaluate(self, stack): | |
push(stack, self.value) | |
return stack | |
class Add: | |
def __init__(self, left, right): |
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
class Num: | |
def __init__(self, value): | |
self.value = value | |
def bc_instructn(self, bytecodes): | |
bytecodes.append(f'push {self.value}') | |
return bytecodes | |
class Add: | |
def __init__(self, left, right): |
NewerOlder