hoverfly is an esoteric, Turing-complete and purely imperative language. The name may be translated, when speaking in another language.
hoverfly was intended to be a 'normal' language, however, since I am new to parsing, I downgraded the syntax to the lowest and it became an interesting concept to be an esoteric language. The name is coming from an insect, that mimics a bee. That's my favorite insect, btw. In the future I still plan to write a serious version of hoverfly. If that happens at some point, this article will still be about the fun version.
The language is almost ready, but the docs here are not very detailed. Please check out the
guide/ folder in repository linked at the bottom for the full walkthrough.
# number- integer
^ number- object
& number- stream
! number- flag
number is an integer
# value <=- result in zero
# value <= value- result is told value
#0 is command pointer, can be used for jump
^ value <=- empty object
^ value <= ^ value => value- pointing to another object
^ value <= "string"- well, a string
^ value => value => value <= value- defining number value of object
global[value][value][value] = value)
# value <= ^ value => value- getting value of object
File descriptors, must already be defined before interpretation. Implementation-dependent. May be passed as argumnets, or whatelse. Originally only 0, 1 and 2 defined for stdio. Having only &? in the code must print all the streams and exit.
# value <= & value- read bytewise
& value <= # value- write bytewise
Act as a predefined jump points. Values are put into the flags object before the interpreting. They can't be changed in runtime.
#0 <= #0 + 1
Available operators: +, -, *, /, (, )
Division is made without a rest:
9 / 2 results in
(something else)/0 produces exception
Now, there are also imports allowed.
They must have following form:
base- code gets imported related to the working directory
lib- code gets imported from lib/ folder in the root directory of hoverfly
path: will always be put a
.fly at the end.
An import reads all the code from provided file
and executes it. Numbers object is private, so any computations can be performed in numbers object without overwriting main file's numbers object. Arguments can be passed to the import file via objects object. Typically the
Single line comments only, start with
^1 <= "Hello World!\n" #1 <= 0 #2 <= ^1 => #1 &1 <= #2 #1 <= #1 + 1 #0 <= #0 - #2 / #2 * 4
#0<=(49-&0)*3 &1<=49 #0<=0
Printing using lib:
^0 <= "Hoverfly is an insect <>" <= lib:io/puts
Available in python: https://github.com/gXLg/hoverfly-eso