For now Doxygen docs - 🌸 Hana Documentation
- Cmake >= 3.12
- Flex
- Bison
- LLVM (version 10.0.1)
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.
touch hello.hana && vim hello.hana
writeln("Hello World!")
Using the hana interpreter
hana hello.hana
Hello World!
hana -h
Opens the Hana help menu.
Variables can be decluwuared using the keyword let
or by using their types int
double
string
boolean
.
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
hahahah
100
50
if《condition》
《statements》
else《condition》
《statements》
-- No else if supported now
-- Single line comment, inspired from lua!
--[[
Multi
Line
Comment
--]]
let c = 5
while c > 0
writeln("UwU")
c = c - 1
else
writeln("Boom")
UwU
UwU
UwU
UwU
UwU
Boom
Function are created by block()
keyword.
Classes can also be created by same keyword block
.
block funcName(《parameters》) : 《returnType》
《statements》
return 《nothing/something》
Refer Testing
for more examples ~
README Credit
Reference Language Kaleidoscope
Other References ghaiklor/llvm-kaleidoscope
Guide https://gnuu.org/2009/09/18/writing-your-own-toy-compiler/