<Fun blogpost about implementing a language>
# linking-together
e
and while not the point of the article, Noulith, the language in question, sort of reminds me of John Ernest’s lil, which may be one of the most lovely little languages without heaps of parenthesis that I’ve ever used.
s
i LOVE noulith hahahaha. i’ve programmed in it a lot and really love the expressivity of this language. the kitchen sink of ways to call functions
m
Nice. I like the topics, the in depth reasoning and choices, and the "fun facts". I also had the idea to write a "implementing a language" article, but am trying to be very "incremental" and target a not-so-developer audience. It's tough not being able to just say random techie stuff when writing about techie stuff 🙂
a
@Mike Austin That’s why I’m here. When I posted programming stuff on Facebook, I’d just get family members saying, “I don’t know what you’re talking about, but you seem to be having fun!”
s
@Eli Mellen do you know if it’s possible to use the lil language? i’m interested in playing around with it
e
It is! I use it all the time. It’s embedded into decker where you can use it as a scripting language, and you can grab a standalone interpreter to run locally from GitHub. It is in the repo as a cosmopolitan libc, I find that works well. Hit me up with any questions @smt
This is one of my favorite programs I’ve written with lil. It isn’t useful, but I think it shows off the language features really well.
Copy code
sys.seed:<http://sys.ms|sys.ms>
cons: "|" split "b|c|d|f|g|h|j|k|l|m|n|p|r|s|t|v|w|z|ch|sh|zh|th"
 vow: "|" split "a|e|i|o|u|y|ee|ai|ae|au"

on syl do random[vow],random[cons] end
on word do syl @ range random[1,2,3,4] end
on words x do " " fuse word @ range x end
speak:words[7]
show[speak]
That generates mostly pronounceable gibberish, like
ushapaiw aih eez enasil auk aeshowychees ehilehuk
and
ainaec eeneewaig ainimimum auvaichaef ojushychaen upenizash ac
Same program in JavaScript,
Copy code
const cons = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "z", "ch", "sh", "zh", "th"];
const vow = ["a", "e", "i", "o", "u", "y", "ee", "ai", "ae", "au"];

const rpick = t => t[Math.floor(Math.random() * t.length)];

const syl = () => rpick(cons) + rpick(vow);

const word = () => {
  const syllables = Array(Math.floor(Math.random() * 3) + 1).fill(null).map(() => syl()).join('');
  return Math.random() > 0.2 ? syllables + rpick(cons) : syllables;
};

const speak = numberOfWords => Array(numberOfWords).fill(null).map(() => word()).join(' ');

console.log(speak(7));