A very, very verbose Tower of Babel conlex implemented in JavaScript

This is my conlex called “Bresenish”. It’s set inspired. The idea is to do for programming data structures what lojban did for propositional logic. I tried this with C# and that was pretty verbose. JS is just as verbose but for different reasons (no built in foreach loops for one, many string manipulation functions missing, etc- JS did have fewer type declarations).

I wish I could write the datastructures of an message in an IDE (integrated development environment), then have a computer serialize it to a speakable conlex. I’m not too concerned about deserialization, humans are smart, but I notice while writing that the IDE, the computer can check to see how many potential parses it has to see if it is too ambiguous. Unlike lojban, the goal isn’t to have a single possible parse tree, since I assuming that the deserializer is a human brain, which has other knowledge available to aid in deserialization. Imagine if you had the 3 words, “mouse, cat, chased”– no matter the order, you can use your knowledge of small mammals to figure out what scenario is most likely.

You can copy the code below to jsFiddle to see the unimpressive results.

writeTowerOfBabelStory();

//Write two sentences of tower of babel in a English to English translation.
//For the conlex version, imagine foreing text in all the strings
function writeTowerOfBabelStory()
{
    //Dictionary
    var elements = new Object();
    elements.Clay = "Clay.INANIM";
    elements.Tower = "Tower.INANIM";
    elements.Bricks = "Bricks.INANIM";
    elements.Men = "Men.ANIM";

    var relations = new Object();
    relations.Bake = "Bake"; //Yields an new element
    relations.Build = "Build"; //Yields an new element
    relations.Say = "Say"; //Yields an new element (that which was said)
    relations.Intersect = "Insersect";//Yields a new set
    relations.Union = "Union"; //Yields a new set
    relations.IdenticalTo = "Identical to"; //Each element in one set is equal to an element in the other
                    //Yields a truth value.
    relations.DescriptionFor = "Is another description for"; //Two sets, describe the same reality, but with non-matching elements
                    //Yields a truth value.
   
    var pronouns = new Object();
    pronouns.anim = "the animate";
    pronouns.inanim = "the inanimate";
    pronouns.element = "an element";
    pronouns.actsOn = function (a, b)
    {
        return a + " acts upon " +b;
    };

    var anaphora = new Object();
    anaphora.ThisSet = "this set";
    anaphora.ThatSet = "that set";
    anaphora.TheOtherSet = "the other set";
    anaphora.YeildsAnNewElement = "previously yeilded new element";

    //Story- The men made bricks out of clay.
    var bricksTopics = new Array();
    bricksTopics.Name = anaphora.YeildsAnNewElement;
    bricksTopics.push(elements.Clay, elements.Bricks, elements.Men);
    var brickRelations = new Array();
    brickRelations.push(relations.Bake, relations.Build);
    var obviationBricks = new Array();
    obviationBricks.push(
        pronouns.actsOn(pronouns.anim, pronouns.inanim)
    );

    //Story- The men made a tower out of bricks.
    var towerTopics = new Array();
    towerTopics.Name = anaphora.YeildsAnNewElement;
    towerTopics.push(elements.Tower, bricksTopics.Name, elements.Men);
    var towerRelations = new Array();
    towerRelations.push(relations.Build);
    var obviationTower = new Array();
    obviationTower.push(
        pronouns.actsOn(pronouns.anim, pronouns.inanim)
    );

    var babel = serialize(bricksTopics, brickRelations, obviationBricks);
    babel += "<br/>";
    babel += serialize(towerTopics, towerRelations, obviationTower);
   
    document.writeln(babel);
    //Optional, list # of possible meanings
    function possibleMeanings(topics, topicRelations, obviations)
    {
        //Each pair of elemements related by topicRelations.
        //Selecting only the possible using the obviations
    }

    function serialize(topics,topicRelations,obviations)
    {
        var utterance = "";
        utterance += "<br/>So there was these ";
        for (var i = 0; i < topics.length; i++)
        {
            utterance += topics[i] + ", ";
        }

        utterance += "<br/>some of which were related to the others via the relations of ";
        for (var j = 0; j < topicRelations.length; j++)
        {
            utterance += topicRelations[j] + ", ";
        }

        utterance += "Who acted on who?<br/>";
        for (var k = 0; k < obviations.length; k++)
        {
            utterance += obviations[k] + ", ";
        }

        return utterance;
    }
}
This entry was posted in Bresenish. Bookmark the permalink.

Comments are closed.