Created
May 11, 2016 20:28
-
-
Save rolph-recto/1a9eee674d78af7a7f906c6e7b44de07 to your computer and use it in GitHub Desktop.
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
| class Main inherits IO { | |
| i : Int <- 1; | |
| s : String; | |
| main() : Object {{ | |
| while (i <= 16) loop { | |
| out_string(line(i).concat(nline)); | |
| i <- i + 1; | |
| } pool; | |
| print_lines(); | |
| i <- 17; | |
| while (i <= 54) loop { | |
| out_string(line(i).concat(nline)); | |
| i <- i + 1; | |
| } pool; print_quoted(); | |
| }}; | |
| line(i : Int) : String { | |
| if i = 1 then "class Main inherits IO {" else | |
| if i = 2 then " i : Int <- 1;" else | |
| if i = 3 then " s : String;" else | |
| if i = 4 then " main() : Object {{" else | |
| if i = 5 then " while (i <= 16) loop {" else | |
| if i = 6 then " out_string(line(i).concat(nline));" else | |
| if i = 7 then " i <- i + 1;" else | |
| if i = 8 then " } pool;" else | |
| if i = 9 then " print_lines();" else | |
| if i = 10 then " i <- 17;" else | |
| if i = 11 then " while (i <= 54) loop {" else | |
| if i = 12 then " out_string(line(i).concat(nline));" else | |
| if i = 13 then " i <- i + 1;" else | |
| if i = 14 then " } pool; print_quoted();" else | |
| if i = 15 then " }};" else | |
| if i = 16 then " line(i : Int) : String {" else | |
| if i = 17 then " s fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi" else | |
| if i = 18 then " };" else | |
| if i = 19 then " print_lines() : Object {{" else | |
| if i = 20 then " i <- 1;" else | |
| if i = 21 then " while (i <= 56) loop {" else | |
| if i = 22 then " let s : String <- s(7).concat(s(11)).concat(i2a(i)).concat(s(8)).concat(q).concat(line(i)).concat(q).concat(s(9)) in" else | |
| if i = 23 then " out_string(s.concat(nline));" else | |
| if i = 24 then " i <- i + 1;" else | |
| if i = 25 then " } pool;" else | |
| if i = 26 then " }};" else | |
| if i = 27 then " print_quoted() : Object {{" else | |
| if i = 28 then " i <- 1;" else | |
| if i = 29 then " while (i <= 9) loop {" else | |
| if i = 30 then " let s : String <- s(7).concat(s(11)).concat(i2c(i)).concat(s(8)).concat(q).concat(i2a(i)).concat(q).concat(s(9)) in" else | |
| if i = 31 then " out_string(s.concat(nline));" else | |
| if i = 32 then " i <- i + 1;" else | |
| if i = 33 then " } pool;" else | |
| if i = 34 then " out_string(s(7).concat(q).concat(s(3)).concat(q));" else | |
| if i = 35 then " i <- 1;" else | |
| if i = 36 then " while (i <= 9) loop { out_string(s(5).concat(s(4))); i <- i + 1; } pool;" else | |
| if i = 37 then " out_string(nline.concat(line(18)).concat(nline));" else | |
| if i = 38 then " out_string(line(55).concat(nline));" else | |
| if i = 39 then " i <- 1;" else | |
| if i = 40 then " while (i <= 20) loop {" else | |
| if i = 41 then " let s : String <- s(7).concat(s(11)).concat(i2a(i)).concat(s(8)).concat(q).concat(s(i)).concat(q).concat(s(9)) in" else | |
| if i = 42 then " out_string(s.concat(nline)); i <- i + 1;" else | |
| if i = 43 then " } pool; out_string(line(56).concat(nline));" else | |
| if i = 44 then " out_string(line(18).concat(nline));" else | |
| if i = 45 then " out_string(s(6).concat(s(18)).concat(s(16)).concat(q).concat(slash));" else | |
| if i = 46 then " out_string(s(14).concat(q).concat(s(2)).concat(nline));" else | |
| if i = 47 then " out_string(s(6).concat(s(19)).concat(s(16)).concat(q).concat(slash).concat(q).concat(q).concat(s(17)).concat(s(3)).concat(s(15)).concat(i2a(1)).concat(s(12)).concat(s(2)).concat(nline));" else | |
| if i = 48 then " out_string(s(6).concat(s(20)).concat(s(16)).concat(q).concat(slash).concat(q).concat(q).concat(s(17)).concat(i2c(1)).concat(s(15)).concat(i2c(1)).concat(s(12)).concat(s(2)).concat(nline));" else | |
| if i = 49 then " out_string(s(1).concat(s(2)).concat(nline));" else | |
| if i = 50 then " }};" else | |
| if i = 51 then " i2a(i : Int) : String {" else | |
| if i = 52 then " if i = 0 then s(10) else let next : Int <- i/10 in i2a(next).concat(i2c(i-next*10)) fi" else | |
| if i = 53 then " };" else | |
| if i = 54 then " i2c(i : Int) : String {" else | |
| if i = 55 then " s(i : Int) : String {" else | |
| if i = 56 then " s(10) fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi" else | |
| s fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi | |
| }; | |
| print_lines() : Object {{ | |
| i <- 1; | |
| while (i <= 56) loop { | |
| let s : String <- s(7).concat(s(11)).concat(i2a(i)).concat(s(8)).concat(q).concat(line(i)).concat(q).concat(s(9)) in | |
| out_string(s.concat(nline)); | |
| i <- i + 1; | |
| } pool; | |
| }}; | |
| print_quoted() : Object {{ | |
| i <- 1; | |
| while (i <= 9) loop { | |
| let s : String <- s(7).concat(s(11)).concat(i2c(i)).concat(s(8)).concat(q).concat(i2a(i)).concat(q).concat(s(9)) in | |
| out_string(s.concat(nline)); | |
| i <- i + 1; | |
| } pool; | |
| out_string(s(7).concat(q).concat(s(3)).concat(q)); | |
| i <- 1; | |
| while (i <= 9) loop { out_string(s(5).concat(s(4))); i <- i + 1; } pool; | |
| out_string(nline.concat(line(18)).concat(nline)); | |
| out_string(line(55).concat(nline)); | |
| i <- 1; | |
| while (i <= 20) loop { | |
| let s : String <- s(7).concat(s(11)).concat(i2a(i)).concat(s(8)).concat(q).concat(s(i)).concat(q).concat(s(9)) in | |
| out_string(s.concat(nline)); i <- i + 1; | |
| } pool; out_string(line(56).concat(nline)); | |
| out_string(line(18).concat(nline)); | |
| out_string(s(6).concat(s(18)).concat(s(16)).concat(q).concat(slash)); | |
| out_string(s(14).concat(q).concat(s(2)).concat(nline)); | |
| out_string(s(6).concat(s(19)).concat(s(16)).concat(q).concat(slash).concat(q).concat(q).concat(s(17)).concat(s(3)).concat(s(15)).concat(i2a(1)).concat(s(12)).concat(s(2)).concat(nline)); | |
| out_string(s(6).concat(s(20)).concat(s(16)).concat(q).concat(slash).concat(q).concat(q).concat(s(17)).concat(i2c(1)).concat(s(15)).concat(i2c(1)).concat(s(12)).concat(s(2)).concat(nline)); | |
| out_string(s(1).concat(s(2)).concat(nline)); | |
| }}; | |
| i2a(i : Int) : String { | |
| if i = 0 then s(10) else let next : Int <- i/10 in i2a(next).concat(i2c(i-next*10)) fi | |
| }; | |
| i2c(i : Int) : String { | |
| if i = 1 then "1" else | |
| if i = 2 then "2" else | |
| if i = 3 then "3" else | |
| if i = 4 then "4" else | |
| if i = 5 then "5" else | |
| if i = 6 then "6" else | |
| if i = 7 then "7" else | |
| if i = 8 then "8" else | |
| if i = 9 then "9" else | |
| "0" fi fi fi fi fi fi fi fi fi | |
| }; | |
| s(i : Int) : String { | |
| if i = 1 then "}" else | |
| if i = 2 then ";" else | |
| if i = 3 then "0" else | |
| if i = 4 then "fi" else | |
| if i = 5 then " " else | |
| if i = 6 then " " else | |
| if i = 7 then " " else | |
| if i = 8 then " then " else | |
| if i = 9 then " else" else | |
| if i = 10 then "" else | |
| if i = 11 then "if i = " else | |
| if i = 12 then ")" else | |
| if i = 13 then "s" else | |
| if i = 14 then "n" else | |
| if i = 15 then "," else | |
| if i = 16 then " : String <- " else | |
| if i = 17 then ".substr(" else | |
| if i = 18 then "nline" else | |
| if i = 19 then "slash" else | |
| if i = 20 then "q" else | |
| s(10) fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi | |
| }; | |
| nline : String <- "\n"; | |
| slash : String <- "\"".substr(0,1); | |
| q : String <- "\"".substr(1,1); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment