Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettogg/hana
Hana is an elegant, clean and minimalistic interpreted programming language inspired from lua, python and javascript <3
https://github.com/kettogg/hana
bison compiler-design flex intermediate-code-generation interpreter lex llvm programming-language yacc
Last synced: 3 months ago
JSON representation
Hana is an elegant, clean and minimalistic interpreted programming language inspired from lua, python and javascript <3
- Host: GitHub
- URL: https://github.com/kettogg/hana
- Owner: kettogg
- License: apache-2.0
- Created: 2023-02-12T22:50:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-23T14:56:07.000Z (almost 2 years ago)
- Last Synced: 2024-09-30T14:42:49.909Z (4 months ago)
- Topics: bison, compiler-design, flex, intermediate-code-generation, interpreter, lex, llvm, programming-language, yacc
- Language: C++
- Homepage: https://syylvette.github.io/Hana/
- Size: 599 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hana
Hana is an elegant, clean and minimalistic interpreted programming language inspired from lua, python and javascript <3⚠️ *WIP ...*
*For now Doxygen docs* - [🌸 Hana Documentation](https://syylvette.github.io/Hana/)
Deps
- Cmake >= 3.12
- Flex
- Bison
- LLVM (version 10.0.1)
Building the interpreter
```
git clone https://github.com/syylvette/Hana.git
cd Hana
mkdir Build && cd Build
cmake .. && make
## Generates a binary 'hana' in Build/Hana directory
./hana -h ## Lists the usage
```
Builiding the binary might take few minutes depending on your Pc.
You can also get the binary from Releases, but it will probably only work on Arch or Arch other based distros,
as the binary was built on Arch linux with x86 architecture.
Usage
Create a hana file
```py
touch hello.hana && vim hello.hana
```
```py
writeln("Hello World!")
```
Run
Using the hana interpreter
```py
hana hello.hana
```
Output
```
Hello World!
```
Documentation
General
hana -h
Opens the Hana help menu.
Variables
Variables can be decluwuared using the keyword let
or by using their types int
double
string
boolean
.
```py
let baka = 99
string tehe = "hahahah"
int chan = 25
let baka = baka + 1
let chan = chan * 2
writeln(tehe)
writeln("%d", baka)
writeln("%d", chan) -- Basically just a scanf alias
```
Output
```
hahahah
100
50
```
Conditionals
```py
if《condition》
《statements》
else《condition》
《statements》
-- No else if supported now
```
Comments
```py
-- Single line comment, inspired from lua!
```
```py
--[[
Multi
Line
Comment
--]]
```
Loops
```py
let c = 5
while c > 0
writeln("UwU")
c = c - 1
else
writeln("Boom")
```
Output
```
UwU
UwU
UwU
UwU
UwU
Boom
```
Functions/Classes
Function are created by ```block()``` keyword.
Classes can also be created by same keyword ```block```.
```py
block funcName(《parameters》) : 《returnType》
《statements》
return 《nothing/something》
```
Refer ```Testing``` for more examples ~
---
> README [Credit](https://github.com/virejdasani/pythOwO)
> Reference Language [Kaleidoscope](https://llvm.org/docs/tutorial/)
> Other References [ghaiklor/llvm-kaleidoscope](https://github.com/ghaiklor/llvm-kaleidoscope)
> Guide https://gnuu.org/2009/09/18/writing-your-own-toy-compiler/