|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | +<title>BCode</title> |
| 7 | +<style> |
| 8 | + body { |
| 9 | + background-color: #1e1e1e; |
| 10 | + color: #c7c7c7; |
| 11 | + font-family: Arial, sans-serif; |
| 12 | + line-height: 1.6; |
| 13 | + padding: 20px; |
| 14 | + } |
| 15 | + h1, h2 { |
| 16 | + color: #ffffff; |
| 17 | + } |
| 18 | + h2 { |
| 19 | + margin-top: 50px; |
| 20 | + border-bottom: 2px solid #444; |
| 21 | + padding-bottom: 5px; |
| 22 | + } |
| 23 | + p { |
| 24 | + margin-bottom: 15px; |
| 25 | + } |
| 26 | + code { |
| 27 | + background-color: #2d2d2d; |
| 28 | + color: #cf38e6; |
| 29 | + padding: 5px 10px; |
| 30 | + border-radius: 5px; |
| 31 | + font-family: "Courier New", Courier, monospace; |
| 32 | + font-size: large; |
| 33 | + } |
| 34 | + pre { |
| 35 | + background-color: #2d2d2d; |
| 36 | + padding: 10px; |
| 37 | + border-radius: 5px; |
| 38 | + overflow-x: auto; |
| 39 | + font-family: "Courier New", Courier, monospace; |
| 40 | + color: #c034d6; |
| 41 | + font-size: large; |
| 42 | + } |
| 43 | + </style> |
| 44 | +</head> |
| 45 | +<body> |
| 46 | + <h1>BCode Full Documentation</h1> |
| 47 | + <h1>Documentacion</h1> |
| 48 | + |
| 49 | + <h2>Variables</h2> |
| 50 | + <p>Declare variables using the <code>VAR</code> keyword.</p> |
| 51 | + <pre> |
| 52 | +VAR name = "Bubu" |
| 53 | +VAR number = 42 |
| 54 | + </pre> |
| 55 | + |
| 56 | + <h2>Functions</h2> |
| 57 | + <p>Define functions with <code>FUN</code>. Use <code>RETURN</code> to exit with a value.</p> |
| 58 | + <pre> |
| 59 | +FUN add(a, b) |
| 60 | + RETURN a + b |
| 61 | +END |
| 62 | + |
| 63 | +FUN greet(name) |
| 64 | + PRINT("Hello, " + name) |
| 65 | +END |
| 66 | + </pre> |
| 67 | + |
| 68 | + <h2>If Statements</h2> |
| 69 | + <p>Use <code>IF</code>, <code>THEN</code>, and <code>ELSE</code> for conditionals.</p> |
| 70 | + <pre> |
| 71 | +IF condition THEN |
| 72 | + PRINT("Condition is true") |
| 73 | +END |
| 74 | + |
| 75 | +IF condition <= 10 THEN |
| 76 | + PRINT("Less or equal to 10") |
| 77 | +ELIF condition == 74 |
| 78 | + PRINT("Equal to 74") |
| 79 | +ELSE |
| 80 | + PRINT("Other value") |
| 81 | +END |
| 82 | + </pre> |
| 83 | + |
| 84 | + <h2>Printing</h2> |
| 85 | + <p>Use the <code>PRINT()</code> function to display text in the output.</p> |
| 86 | + <pre> |
| 87 | +PRINT("Hello, BCode!") |
| 88 | + </pre> |
| 89 | + |
| 90 | + <h2>For Loops</h2> |
| 91 | + <p>Create loops with <code>FOR</code> and <code>TO</code>.</p> |
| 92 | + <pre> |
| 93 | +FOR i = 1 TO 10 THEN |
| 94 | + PRINT(i) |
| 95 | +END |
| 96 | + </pre> |
| 97 | + |
| 98 | + <h2>Comments</h2> |
| 99 | + <p>Add comments using the <code>#</code> symbol. They are ignored during execution.</p> |
| 100 | + <pre> |
| 101 | +# This is a comment in BCode |
| 102 | +# I <3 BCODE |
| 103 | + </pre> |
| 104 | + |
| 105 | + <h2>Joining Function</h2> |
| 106 | + <p>Example of a single-line function with the joining feature.</p> |
| 107 | + <pre> |
| 108 | +FUN oopify(prefix) -> prefix + "oop" |
| 109 | + </pre> |
| 110 | + |
| 111 | + <h2>Overview Example</h2> |
| 112 | + <p>Here's a more complex example using various features of BCode:</p> |
| 113 | + <pre> |
| 114 | +# This is a very cool example |
| 115 | + |
| 116 | +FUN oopify(prefix) -> prefix + "oop" |
| 117 | + |
| 118 | +FUN join(elements, separator) |
| 119 | + VAR result = "" |
| 120 | + VAR len = LEN(elements) |
| 121 | + |
| 122 | + FOR i = 0 TO len THEN |
| 123 | + VAR result = result + elements/i |
| 124 | + IF i != len - 1 THEN |
| 125 | + VAR result = result + separator |
| 126 | + END |
| 127 | + END |
| 128 | + |
| 129 | + RETURN result |
| 130 | +END |
| 131 | + |
| 132 | +FUN map(elements, func) |
| 133 | + VAR new_elements = [] |
| 134 | + |
| 135 | + FOR i = 0 TO LEN(elements) THEN |
| 136 | + APPEND(new_elements, func(elements/i)) |
| 137 | + END |
| 138 | + |
| 139 | + RETURN new_elements |
| 140 | +END |
| 141 | + |
| 142 | +PRINT("Greetings universe!") |
| 143 | + |
| 144 | +FOR i = 0 TO 5 THEN |
| 145 | + PRINT(join(map(["l", "sp"], oopify), ", ")) |
| 146 | +END |
| 147 | + </pre> |
| 148 | + |
| 149 | +</body> |
| 150 | +</html> |
0 commit comments