<h1 align="center">Bhai Lang</h1>
<p align="center">
<a href="https://lgtm.com/projects/g/DulLabs/bhai-lang/alerts/"><img alt="Total alerts" src="https://img.shields.io/lgtm/alerts/g/DulLabs/bhai-lang.svg?logo=lgtm&logoWidth=18"/></a>
<a href="https://lgtm.com/projects/g/DulLabs/bhai-lang/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/DulLabs/bhai-lang.svg?logo=lgtm&logoWidth=18"/></a>
<a href="https://github.com/DulLabs/bhai-lang/actions/workflows/node.js.yml/badge.svg"><img alt="Build" src="https://github.com/DulLabs/bhai-lang/actions/workflows/node.js.yml/badge.svg"/></a>
<a href="https://bhailang.js.org/"><img alt="Build" src="https://img.shields.io/badge/website-bhailang.js.org-orange"/></a>
<a href="https://www.npmjs.com/package/bhailang"><img alt="Build" src="https://img.shields.io/badge/npm-bhailang-orange"/></a>
</p>
<p align="center">
This is official repository for bhai-lang.<br><br>
<b>Bhai lang is a toy programming language written in Typescript.</b>
</p>
<br>
<h2 align="center">Installation</h2>
```
npm i -g bhailang
```
<h2 align="center">Usage</h2>
<h4 align="left">Create a new file (<code>test.bhai</code>)</h4>
<h4 align="left">Edit the file with a text editor.
You can also try out your code on <a href="https://bhailang.js.org/#playground">Bhai Lang PlayGround</a></h4>
```
hi bhai
bol bhai "Hello bhai";
bye bhai
```
<h4 align="left">Run</h4>
```
bhailang test.bhai
```
<h4 align="left">Output</h4>
```
hello bhai
```
<h2 align="center">Documentation</h2>
<h3 align="center">General</h3>
<p align="center"><code>hi bhai</code> is the entrypoint for the program and all program must end with <code>bye bhai</code>. Anything outside of it will be ignored.</p>
```
This will be ignored
hi bhai
// Write code here
bye bhai
This too
```
<h3 align="center">Variables</h3>
<p align="center">Variables can be declared using <code>bhai ye hai</code>.</p>
```
hi bhai
bhai ye hai a = 10;
bhai ye hai b = "two";
bhai ye hai c = 15;
a = a + 1;
b = 21;
c *= 2;
bye bhai
```
<h3 align="center">Types</h3>
<p align="center">Numbers and strings are like other languages. Null values can be denoted using <code>nalla</code>. <code>sahi</code> and <code>galat</code> are the boolean values.</p>
```
hi bhai
bhai ye hai a = 10;
bhai ye hai b = 10 + (15*20);
bhai ye hai c = "two";
bhai ye hai d = 'ok';
bhai ye hai e = nalla;
bhai ye hai f = sahi;
bhai ye hai g = galat;
bye bhai
```
<h3 align="center">Built-ins</h3>
<p align="center">Use <code>bol bhai</code> to print anything to console.</p>
```
hi bhai
bol bhai "Hello World";
bhai ye hai a = 10;
{
bhai ye hai b = 20;
bol bhai a + b;
}
bol bhai 5, 'ok', nalla , sahi , galat;
bye bhai
```
<h3 align="center">Conditionals</h3>
<p align="center">Bhailang supports if-else-if ladder construct , <code>agar bhai</code> block will execute if condition is <code>sahi</code>, otherwise one of the subsequently added <code>nahi to bhai</code> blocks will execute if their respective condition is <code>sahi</code>, and the <code>warna bhai</code> block will eventually execute if all of the above conditions are <code>galat</code>
```
hi bhai
bhai ye hai a = 10;
agar bhai (a < 20) {
bol bhai "a is less than 20";
} nahi to bhai ( a < 25 ) {
bol bhai "a is less than 25";
} warna bhai {
bol bhai "a is greater than or equal to 25";
}
bye bhai
```
<h3 align="center">Loops</h3>
<p align="center">Statements inside <code>jab tak bhai</code> blocks are executed as long as a specified condition evaluates to sahi. If the condition becomes <code>galat</code>, statement within the loop stops executing and control passes to the statement following the loop. Use <code>bas kar bhai</code> to break the loop and <code className="language-cpp">agla dekh bhai</code> to continue within loop.</p>
```
hi bhai
bhai ye hai a = 0;
jab tak bhai (a < 10) {
a += 1;
agar bhai (a == 5) {
bol bhai "andar se bol bhai ", a;
agla dekh bhai;
}
agar bhai (a == 6) {
bas kar bhai;
}
bol bhai a;
}
bol bhai "done";
bye bhai
```
<h2 align="center">Development</h2>
<p align="center">You can explore abstract syntax tree(AST) of bhailang <a href="https://bhailang-ast.netlify.app/" target="_blank">here</a>.</p>
没有合适的资源?快使用搜索试试~ 我知道了~
一种用Typescript编写的玩具编程语言_TypeScript_JavaScript_下载.zip
共158个文件
ts:87个
json:19个
js:15个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 164 浏览量
2023-04-25
10:42:06
上传
评论
收藏 272KB ZIP 举报
温馨提示
一种用Typescript编写的玩具编程语言_TypeScript_JavaScript_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
一种用Typescript编写的玩具编程语言_TypeScript_JavaScript_下载.zip (158个子文件)
CNAME 16B
global.css 2KB
.gitignore 458B
.gitignore 23B
googleda2025bf247affad.html 53B
favicon.ico 4KB
_error.js 2KB
next.config.js 1KB
sentry.server.config.js 776B
sentry.client.config.js 766B
tailwind.config.js 451B
eslint-preset.js 189B
jest.config.js 117B
jest.config.js 117B
jest.config.js 117B
postcss.config.js 82B
.eslintrc.js 50B
.eslintrc.js 50B
.eslintrc.js 50B
.eslintrc.js 50B
.eslintrc.js 50B
package-lock.json 588KB
package.json 1KB
package.json 966B
package.json 937B
package.json 927B
package.json 879B
nextjs.json 567B
base.json 519B
import-sorter.json 472B
turbo.json 281B
react-library.json 234B
package.json 229B
package.json 167B
tsconfig.json 126B
tsconfig.json 105B
tsconfig.json 105B
tsconfig.json 104B
tsconfig.json 103B
tsconfig.json 103B
LICENSE 1KB
CODE_OF_CONDUCT.md 5KB
README.md 4KB
README.md 4KB
CONTRIBUTING.md 4KB
README.md 1KB
pull_request_template.md 653B
README.md 106B
Other.md 44B
.nojekyll 0B
sentry.properties 175B
bhailang.svg 10KB
positiveTestsHelper.ts 37KB
positiveTestsProvider.ts 21KB
helper.test.ts 17KB
negativeTestsProvider.ts 13KB
bhaiLangModule.ts 10KB
negativeTestsHelper.ts 9KB
testRunner.test.ts 6KB
unitTestsForNegativeCases.test.ts 4KB
binaryExpression.ts 4KB
bhaiLangSpec.ts 3KB
interpreterModule.ts 3KB
index.ts 3KB
interpreterModule.test.ts 3KB
index.ts 3KB
tokenizerImpl.test.ts 2KB
ifStatement.ts 2KB
tokenExecutor.test.ts 2KB
index.ts 2KB
variableStatement.ts 2KB
ifStatement.ts 2KB
assignmentExpression.ts 2KB
testRunner.test.ts 2KB
scope.ts 2KB
index.ts 2KB
assignmentExpression.ts 2KB
whileStatement.ts 1KB
index.ts 1KB
statementList.ts 1KB
primaryExpression.ts 1KB
constants.ts 1KB
blockStatement.ts 1KB
index.ts 1KB
tokenExecutor.ts 1KB
whileStatement.ts 1KB
printStatement.ts 1KB
initStatement.ts 1KB
blockStatement.ts 1KB
variableDeclaration.ts 899B
statement.test.ts 885B
printStatement.ts 864B
index.ts 821B
syntax.ts 799B
paranthesizedExpression.ts 644B
identifierExpression.ts 637B
bhaiLangModule.test.ts 624B
variableStatement.ts 608B
expressionStatement.ts 604B
interpreter.ts 594B
共 158 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功