- take a laptop into the toilet
- install a programmers keyboard on my phone
- find a language that is easily swiped
The soft, onscreen, swipeable keyboard on my Android phone has a qwerty layout, with a comma and a full-stop (period), and some other keys to switch to other screens. If I need to input parentheses or suchlike I need to go find parentheses in some other screen. If I want to input getElementById, I need to input it letter-by-letter or add it to my dictionary.
So, what languages are out there that have almost no punctuation and use plain English words? Coffeescript are Python both pretty good contenders, but they rely on whitespace, and colons are necessary. Pretty much all languages use single and/or double quotes for strings.
So, I'm writing my own.
Features
Here are the requirements I decided upon, given my needs...- Swipeable keywords - i.e. plain english
- Not dependent on indentation
- No punctuation, except for commas and full-stops (periods)
I then decided that it shoulda also be...
- interpretted
- object oriented
- loosely typed
- case insensitive
Implementation
I've written a crude interpretter in Perl. I <3 Perl. It's great for parsing text, and is loosely typed. It's very quick for prototyping.I decided to make some of the more detailed decisions as I went along. But I already had in my head that periods would need to signify the end of a statement, that blocks would need to be named, and that strings would need to be delimited by some number of commas or written as a block. I decided that the verb/command/function name would come first in the sentence, and that arguments would follow, and that arguments would be separated by commas.
I figured that the interpreter could parse and run blocks of code as needed, so flow control meant that a block wasn't going to be run, then it would need to be parsed. I might want access for native perl functions if necessary, so I popped that in there. And it seemed easiest to implement a spreadsheet-style IF function. If(what, do, else). Doing it this way avoids adding any more syntax to the language.
The current version can be found here: http://ift.tt/2asu0Rn
via Scientist going mad http://ift.tt/2adOYXg
No comments:
Post a Comment