Show HN: I created a language called AntiLang – breaking all the conventions
siruscodes.github.ioAntiLang is an interpreted programming language written in Go. The basic idea of this is to keep all the logical parts of a language same, but reverse the structure of it.
The idea for this project came when I was having a long midnight conversation with my friend and thought of writing such a weird language. The initial draft was far worse than the current implementation; we thought of reversing the brackets and the language would be read from bottom to top. I'm happy that I dropped that idea
Technical details: As the interpreter is written in Golang, I compiled it to WASM, and the whole interpreter is running in the browser. For the editor, I'm using Monaco, the same library that powers the text editor in VSCode. I learnt how to build it while reading "Write an Interpreter in Go" by Thorsten Ball.
The project is opensourced - https://github.com/SirusCodes/AntiLang - do give it a star if you like the project.
The control flow is basically smalltalk funnily enough, since it has effectively no language level control flow, if/while etc are all just messages in the form of
```
[condition] whileTrue: [code]
(condition) ifTrue: [code] ifFalse: [code]
```
A lot of people at Reddit told me that it resembles SmallTalk, Factor, and Forth. Being someone who started coding in last decade I have only heard the names but never saw the syntax, but true it looks surprisingly similar. I can't really fathom that people actually built stuff in those language (probably better things that we build today)
Postfixes are easier to use, if you know how to use them. They're not only used in programming but also in spoken language:
Sentences that simple are equally understandable using the verb as a postfix or infix. When sentences get longer that changes, though: In the first sentence, it's clear that the extra clause is something the sentence has, not the verb. The second example has what is called a dangling modifier, which is a clause at the end of the sentence that ambiguously could be describing more than one thing, in this case it could mean that either the sentence has an extra clause or the verb has an extra clause.The lack of ambiguity also means it takes fewer commands to describe a single operation. For example, in an calculator with infix notation, which is what most people learn, calculating the multiple of four pairs of sums would require the following keypresses:
With an RPN calculator, which has a postfix notation, it would only require these keypresses: That's 24 in the first example and 19 in the latter, a reduction of over 20%.My grandma never really learned how to use a computer and was generally not very good at complex instructions. When she learned to use a calculator, RPN was just as common as postfix notation, and she was able to figure out how to use RPN, but had trouble figuring out postfix notation. Nowadays, schools usually only teach postfix notation, so most students aren't exposed to the easier method, and will have to do extra work, in the short term, to lean it, but it means calculations will require less work, once learned.
tl;dr: Postfix notation is the Dvorak keyboard to infix notation's Qwerty keyboard. The former is easier and faster, but everyone learns the latter. Putting in the extra work to learn the former will save you more time in the long run.
Thanks for the explanation. I don't agree with your point that postfix is easier; maybe it's because most people are not used to thinking in postfix. It can be faster and easier for computers, but we build software for people, and it increases cognitive load on the users.
It might be fewer keystrokes, but I feel for most people, the difference in keystrokes doesn't justify the cognitive load it adds.
apl-family languages also often read easier right to left
A good effort and took me a minute to adjust to not knowing what's going on. Title made me hope for something more esotheric than just backwards code, though.
I'm sorry to disappoint you, maybe next time I will have something more esoteric
This is what perl looks like to people who don't know it.
Thanks for reminding me how reading code feels when I just got started.
We all have been there
Reminds me of RPL
https://en.wikipedia.org/wiki/RPL_(programming_language)
I wouldnt discount your work. Someone who thinks a bit different might find it a workable onramp into coding where others have failed.
I had fun, lost my mind, and a few friends.. probably. thanks!
a very good language this seems to me like
I wonder if this can be considered an info hazard. Nice job, but don't do it again.
I will try my best to resist the temptation ;)
ugh I like it but I had to close the tab right away
[flagged]