https://github.com/4nkitd/slang
slang 🐕🦺 | a Programing language written to understand how programing languages are written
https://github.com/4nkitd/slang
go golang programming-language
Last synced: 6 months ago
JSON representation
slang 🐕🦺 | a Programing language written to understand how programing languages are written
- Host: GitHub
- URL: https://github.com/4nkitd/slang
- Owner: 4nkitd
- License: gpl-2.0
- Created: 2021-10-22T18:10:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T21:10:49.000Z (over 4 years ago)
- Last Synced: 2025-02-02T09:31:25.159Z (12 months ago)
- Topics: go, golang, programming-language
- Language: Go
- Homepage: https://4nkitd.github.io/slang/
- Size: 80.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# slang 🐕🦺
goal was to learn how a interpreter works, in other works who does these programing languages i use on daily basis works behind the seen how a variable is assigned it's value and other things in the same realm.
## why Go ?
before this i mainly worked with scripting language other than java. the gofmt and binary file output are the main reasons though.
## can i use this language ?
### NO
this barely even compare to the stepping stones of a daily driven language like go or js. it exists only so that someone can read and understand how a language works under the hood.
---
### Main Components of a language
- Token list
- Tokenizer ( lexer )
- Parser
- Compiler
### How to RUN
```bash
#file is a flag , use it to run your file
slang -file ./sample/sample.so
```
OR
```bash
slang
# running slang in your terminal without any flags gives you a console to work with.
```
### Supported Datatype
- Boolean
- Integer
- String
### How to define a variable
```
let x = 42;
```
### How to if/else
Does not support elseif
```
if (x == 1) {
return true;
} else {
return false;
}
```
### How to use a function
```
let fibonacci = fn (x) {
if (x == 0) {
return 0;
} else {
if (x == 1) {
return 1;
} else {
fibonacci(x - 1) + fibonacci(x - 2);
}
}
};
fibonacci(15);
```