Skip to content
/ Hana Public

Hana is an elegant, clean and minimalistic interpreted programming language inspired from lua, python and javascript <3

License

Notifications You must be signed in to change notification settings

ketgg/Hana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

touch hello.hana && vim hello.hana
writeln("Hello World!")

Run

Using the hana interpreter

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.

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

ifcondition》
  《statementselsecondition》
  《statements-- No else if supported now

Comments

-- Single line comment, inspired from lua!
--[[
  Multi
  Line
  Comment
--]]

Loops

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.

block funcName(《parameters》) : 《returnType》
    《statementsreturnnothing/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/