Here's a riddle: it's the weekend, about a week before CC23 is due. You're progress is approximately zero, you can't be bothered to work on the one project of merit that you've been delaying for a year, and you are also determined to continue procrastinating your actual school work. What do you?

Why, invent an esolang, of course! Nonsense is an esoteric programming language based around English words; any and every English sentence you could write is a valid program, though most programs that do anything remotely useful will probably be nonsensical jumbles of words and numbers.

How do you write programs in Nonsense? Well, to avoid just repeating the documentation found in the GitHub repo, the basic principles are:
    Programs are split into words, which are then split into syllables; each syllable starts and ends with a consonant with vowels in between.
    Every consonant is an integer variable that can be read and written to (initially zero).
    There is an arbitrarily long array for storage (like BF).
    The first entry of the array is basically Ans from TI-Basic, and is always updated after each syllable.
    Vowels correspond to binary and unary instructions; the first consonant of a syllable is the operand, and the last consonant is the destination (and second operand if necessary).
    Punctuation is used for looping and conditionals.

The repo includes some sample programs and specific descriptions of each instruction, as well as an interpreter I mocked up in Python for actually executing Nonsense programs. I'll eventually get around to making a program page with tutorials and better docs and all that, but this should be sufficient to get going. For example,

Hello World!

Code:
72 ey 100 envoy nab 108 eyry em 111 entry 32 ey eon 119 ey try 114 ey my by nay


I'm pretty proud of how the language has turned out, as it is both reasonably powerful (read: it's not just BF with different symbols) but also rather challenging to write (since words must be English words). I'd be interested to see what programs you guys can come up (and how short you can get them). This esolang is also only like a week old, so suggestions for changes are definitely welcome.
So I've made some slight changes to the Nonsense interpreter, mostly to due with error handling and reading from the command line; you can now run the interpreter from the command line with your paragraph as an argument. The interpreter will now also display the syllables it parses from the input paragraph.

Again, if you guys are up for it, try your hand at writing some programs in Nonsense; any successful implementations are almost guaranteed to end up on the GitHub repo as a sample paragraph. I'm also generally interested in the sort of "emergent behavior" this language might have: what sorts of words are going to the most useful and/or most common? What tricks or vowel combinations will proliferate?
IRC wrote:
[12:16:10 PM] [iPhoenix] I also think it would be nice for your thing to output "english" versions of parsed words along with the word, ex. the word "err" is encountered, print "err: S[0]->r; r->r"
[12:16:26 PM] [iPhoenix] s/english/human-readable
[12:19:21 PM] [iPhoenix] Then, run that over your entire dictionary and replace the old documentation with that



I'm like maybe 75% kidding there Evil or Very Mad

I'll be sure to check it out when I have free time next, however unlikely that is. I read the docs-this seems like it would be really fun to program in.

What if words starting with capital letters had special functionality? Something minor, probably just semantic sugar at most, but it would give an extra dimension when optimizing, as you need to look for /words/ that /start/ with the letter you're changing the functionality of.
_iPhoenix_ wrote:
IRC wrote:
[12:16:10 PM] [iPhoenix] I also think it would be nice for your thing to output "english" versions of parsed words along with the word, ex. the word "err" is encountered, print "err: S[0]->r; r->r"
[12:16:26 PM] [iPhoenix] s/english/human-readable
[12:19:21 PM] [iPhoenix] Then, run that over your entire dictionary and replace the old documentation with that



I've just pushed an update to the interpreter that does precisely that (well, for syllables rather than full words, but same idea) if you specify an additional argument. I also switched program to using Python's actual arg parsing library, so the entire thing should have proper command line functionality now.

_iPhoenix_ wrote:

What if words starting with capital letters had special functionality? Something minor, probably just semantic sugar at most, but it would give an extra dimension when optimizing, as you need to look for /words/ that /start/ with the letter you're changing the functionality of.


I'll look into this, cause that would be an interesting little feature. Currently I've just been writing in capital letters as they would be present normally (e.g. after periods and proper nouns), since the paragraph gets converted to all lowercase anyway. I'm not entirely sure at the moment would that extra "semantic sugar" would be; perhaps something to do with not updating the result? I'll play around with it.
Well, it's been quite a few months, but after chatting with some friends about Turing completeness where this esolang popped into conversation, I've decided to give it another look. Turns out my interpreter was actually dysfunctional when it came to looping, so I overhauled the entire program and got it working very smoothly. A few other additions/changes include:
    --inspect flag, which outputs the state of consonants and the array after each instruction

    --verbose flag has been removed; use --inspect to get human-readable instructions

    --char flag, which restricts consonants and array cells to 0-255; there are still some bugs with it that I should get patched out soon.

    "?" now uses a corresponding "." to denote the end of the conditional, rather than just skipping one word.

    "o" no longer does in-place increment if it begins a word; such a case instead sets the location consonant to 1 (or 2, if beginning with "oo").

    "y" now prints the result in all cases; previously a word like "oyster" would print "\0".

I've also included bf_convert.py, which takes a BrainFuck program and converts to Nonsense by a set of substitutions for each BF command. Specifying the --pointer [arg] will change what consonant is used as the primary BF pointer (default is "s"). Not all consonants are supported (yet), though I'm doubtful all of them can be done (I'm looking at you, "q" and "x").

The converter seems to fail to properly convert BF programs which utilize byte wrap-around, which is a bug I'm still diagnosing. Regardless, the converter demonstrates that Nonsense is actually Turing-complete, which is nice. All of this can of course be cloned from the GitHub repo. If you find any other bugs, just raise an issue and I'll take a look.

And, for anyone particularly interested, I'd like to see what programs people can write. Currently the only included sample Nonsense paragraph is "Hello world!" and I'd like to get some more. I'm also intrigued by the idea of Nonsense paragraph which isn't; that is, it's a (loosely) coherent sentence or set of sentences. There are quite a few Cemetechians who would be better at this than I, so all contributions are appreciated.
I pushed a few more minor changes; mostly interpreter improvements and little bug fixes. A few notable changes though:
    --inspect was renamed to --debug (-d)

    --write (-w) will write equivalent Python 3 code to the specified file (if given).

    --input (-i) will prompt program input at the start, then read from it during execution (as opposed to asking for each character one at a time). Input is also now properly cast to a char rather than an int.

    bf_convert.py now supports every consonant. The shortest substitutions include 'l', 'm', 'v', 'x', and 'z', strangely enough.

I'm now looking into the prospect of a self-interpreter, which is definitely doable but quite the challenge. I'm also considering actually giving capital letters a unique use; my current though is that a capitalized consonant (which must appear at the beginning of word) stores the result to itself before doing any operation. It fits the structure of sentences nicely, but it also stifles creativity a bit, as instead of having to find a word that starts with 'e' or use a zeroed consonant to do the same thing, you can just use a capital letter. Feedback is welcome on this.

Also, those bugs with BF converted programs should be resolved. If you find a BF program that gets improperly converted, raise an issue on the repo.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement