Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: New Word Generator

From:Petr Mejzlík <imploder@...>
Date:Thursday, October 4, 2007, 4:42
Dne Wed, 03 Oct 2007 16:07:59 +0200 Benct Philip Jonsson
<conlang@...> napsal/-a:

> On 2007-09-29 Petr Mejzlík wrote: >> > I'd like to know how the nested parentheses thing works... >> It works very simply, like parenthses in maths. What's inside a pair >> of parentheses is treated as a single unit - as if it was a single >> letter. You can further combine these units and make larger units >> containing them. A block bordered by [ and ] will always behave like >> one letter, no matter that it can be rendered as ten letters or even >> more. Round brackets do the same except that what's inside them >> either appears in the word or not. > > I have no problem with how it works inputwise. I rather > wonder how the program parses it and translates it into > conditionals and commands.
There is a function called render() that can either render or count words. It divides each level of immiersion in the parenthesis structure into fragments. Each fragment consists of a block in parentheses or a sequence of letters (with no parentheses within). The render() function calls itself recursively to get each fragment further broken down into smaller fragments until there are no parentheses. I can send you the code if you wish.