You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9816097
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,18 @@
1
-
# Broo-code
1
+
# Bro-code
2
2
3
-
Bro code is a toy programming language written in TypeScript.
3
+
[](https://github.com/ClaudeMaxUser/bro-code/actions/workflows/deploy.yml)
This repository is private. The public way to use Bro code is the web playground.
7
+
Bro-code is a toy programming language written in TypeScript with its own custom tokenizer, recursive-descent parser, AST, and tree-walking interpreter.
Use <codeclassName="language-cpp">say bro</code> to print expressions
94
+
and comma-separated values to the console.
95
+
</>
96
+
),
97
+
code: `hi bro
98
+
say bro "Hello World";
99
+
bro this is a = 10;
100
+
{
101
+
bro this is b = 20;
102
+
say bro "a + b =", a + b;
103
+
}
104
+
say bro 5, 'ok', nope, yep, nah;
80
105
bye bro
81
106
`,
82
107
},
83
108
{
84
109
name: "Conditionals",
85
110
description: (
86
111
<>
87
-
Bro-code supports if-else-if ladder construct , <codeclassName="language-cpp">if bro</code> block will execute if condition is <codeclassName="language-cpp">yep</code>, otherwise one of the subsequently added <codeclassName="language-cpp">else if bro</code> blocks will execute if their respective condition is <codeclassName="language-cpp">yep</code>, and the <codeclassName="language-cpp">else bro</code> block will eventually execute if all of the above conditions are <codeclassName="language-cpp">nah</code>.
Statements inside <codeclassName="language-cpp">while bro</code> blocks are executed as long as a specified condition evaluates to <codeclassName="language-cpp">yep</code>. If the condition becomes <codeclassName="language-cpp">nah</code>, statement within the loop stops executing and control passes to the statement following the loop.
107
-
Use <codeclassName="language-cpp">stop bro</code> to break the loop and <codeclassName="language-cpp">next bro</code> to continue within loop.
134
+
Use <codeclassName="language-cpp">while bro</code> to loop while a
135
+
condition is <codeclassName="language-cpp">yep</code>. Use{" "}
136
+
<codeclassName="language-cpp">stop bro</code> to break out or{" "}
137
+
<codeclassName="language-cpp">next bro</code> to jump to the next
138
+
iteration.
108
139
</>
109
140
),
110
141
code: `hi bro
111
-
bro this is a = 0;
112
-
while bro (a < 10) {
113
-
a += 1;
114
-
if bro (a == 5) {
115
-
say bro "inside say bro ", a;
116
-
next bro;
117
-
}
118
-
if bro (a == 6) {
119
-
stop bro;
120
-
}
121
-
say bro a;
142
+
bro this is a = 0;
143
+
while bro (a < 10) {
144
+
a += 1;
145
+
if bro (a == 5) {
146
+
say bro "inside loop:", a;
147
+
next bro;
148
+
}
149
+
if bro (a == 6) {
150
+
stop bro;
122
151
}
123
-
say bro "done";
152
+
say bro a;
153
+
}
154
+
say bro "done";
124
155
bye bro
125
-
`
156
+
`,
157
+
},
158
+
{
159
+
name: "Blocks & Scope",
160
+
description: (
161
+
<>
162
+
Blocks created with <codeclassName="language-cpp">{ }</code>{" "}
163
+
establish local lexical scopes. Variables declared within inner blocks
164
+
shadow outer variables.
165
+
</>
166
+
),
167
+
code: `hi bro
168
+
bro this is msg = "outer";
169
+
{
170
+
bro this is msg = "inner";
171
+
say bro "Inside block:", msg;
126
172
}
127
-
173
+
say bro "Outside block:", msg;
174
+
bye bro
175
+
`,
176
+
},
128
177
];
129
178
130
179
exportdefaultfunctionDocumentation(){
@@ -134,7 +183,9 @@ export default function Documentation() {
134
183
<div>
135
184
<h2className="section-title">Examples &Docs</h2>
136
185
<pclassName="section-subtitle mt-3 max-w-2xl">
137
-
Bro-code is a dynamically typed toy language powered by a parser and interpreter written in Typescript. Use these examples as a quick map of the language.
186
+
Bro-code is a dynamically typed toy language powered by a parser and
187
+
interpreter written in Typescript. Use these examples as a quick map
0 commit comments