• Proof that the neos universal compiler parser correctly parses and emit

    From Mr Flibble@3:633/280.2 to All on Sun Feb 16 06:10:30 2025
    Subject: Proof that the neos universal compiler parser correctly parses and emits SEMANTICS

    Hi!

    The CST includes all syntactical elements from the grammar along with
    any semantic tagging specified in the grammar which is then simplified
    to the AST that contains semantics only:

    Parse time: 0.001 seconds (168000 characters/second, 7000
    lines/second)
    1|
    2| xyzzY0 foo()
    3| {
    4| 1234; /* comment one */
    5| x := 1 + 2 + 3 - 4 - 5 + 6; // comment two
    6| y := 7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2;
    7| }

    language.function.definition = [xyzzY0 foo()\n {\n 1234; /*
    comment one */\n x := ...]
    language.function.prototype = [xyzzY0 foo()]
    language.function.return.type = [xyzzY0]
    language.function.name = [foo]
    language.function.parameters = [()]
    language.function.body = [{\n 1234; /* comment one */\n x :=
    1 + 2 + 3 - 4 - 5...]
    number.integer = [1234]
    object.assign = [x := 1 + 2 + 3 - 4 - 5 + 6]
    object = [x]
    math.addition = [1 + 2 + 3 - 4 - 5 + 6]
    math.operator.add = [+]
    math.operator.subtract = [-]
    math.operator.subtract = [-]
    math.operator.add = [+]
    math.operator.add = [+]
    number.integer = [1]
    number.integer = [2]
    number.integer = [3]
    number.integer = [4]
    number.integer = [5]
    number.integer = [6]
    object.assign = [y := 7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2]
    object = [y]
    math.addition = [7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2]
    math.operator.add = [+]
    math.operator.add = [+]
    math.operator.add = [+]
    number.integer = [7]
    math.multiplication = [-42.001 * 1.0 * (5-1+2)]
    math.operator.multiply = [*]
    math.operator.multiply = [*]
    math.operator.negate = [-42.001]
    number.float = [-42.001]
    number.float = [1.0]
    math.addition = [5-1+2]
    math.operator.add = [+]
    math.operator.subtract = [-]
    number.integer = [5]
    number.integer = [1]
    number.integer = [2]
    math.operator.negate = [-x]
    object = [x]
    math.multiplication = [x * 2]
    math.operator.multiply = [*]
    object = [x]
    number.integer = [2]

    /Flibble

    --- MBSE BBS v1.0.8.4 (Linux-x86_64)
    * Origin: Eweka Internet Services (3:633/280.2@fidonet)
  • From Mr Flibble@3:633/280.2 to All on Sun Feb 16 11:32:20 2025
    Subject: Re: Proof that the neos universal compiler parser correctly parses and emits SEMANTICS

    On Sat, 15 Feb 2025 19:10:30 +0000, Mr Flibble <leigh@i42.co.uk>
    wrote:

    Hi!

    The CST includes all syntactical elements from the grammar along with
    any semantic tagging specified in the grammar which is then simplified
    to the AST that contains semantics only:

    Parse time: 0.001 seconds (168000 characters/second, 7000
    lines/second)
    1|
    2| xyzzY0 foo()
    3| {
    4| 1234; /* comment one */
    5| x := 1 + 2 + 3 - 4 - 5 + 6; // comment two
    6| y := 7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2;
    7| }

    language.function.definition = [xyzzY0 foo()\n {\n 1234; /*
    comment one */\n x := ...]
    language.function.prototype = [xyzzY0 foo()]
    language.function.return.type = [xyzzY0]
    language.function.name = [foo]
    language.function.parameters = [()]
    language.function.body = [{\n 1234; /* comment one */\n x :=
    1 + 2 + 3 - 4 - 5...]
    number.integer = [1234]
    object.assign = [x := 1 + 2 + 3 - 4 - 5 + 6]
    object = [x]
    math.addition = [1 + 2 + 3 - 4 - 5 + 6]
    math.operator.add = [+]
    math.operator.subtract = [-]
    math.operator.subtract = [-]
    math.operator.add = [+]
    math.operator.add = [+]
    number.integer = [1]
    number.integer = [2]
    number.integer = [3]
    number.integer = [4]
    number.integer = [5]
    number.integer = [6]
    object.assign = [y := 7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2]
    object = [y]
    math.addition = [7 + -42.001 * 1.0 * (5-1+2) + -x + x * 2]
    math.operator.add = [+]
    math.operator.add = [+]
    math.operator.add = [+]
    number.integer = [7]
    math.multiplication = [-42.001 * 1.0 * (5-1+2)]
    math.operator.multiply = [*]
    math.operator.multiply = [*]
    math.operator.negate = [-42.001]
    number.float = [-42.001]
    number.float = [1.0]
    math.addition = [5-1+2]
    math.operator.add = [+]
    math.operator.subtract = [-]
    number.integer = [5]
    number.integer = [1]
    number.integer = [2]
    math.operator.negate = [-x]
    object = [x]
    math.multiplication = [x * 2]
    math.operator.multiply = [*]
    object = [x]
    number.integer = [2]

    /Flibble

    There was an error in the grammer; can you spot it? :)

    /Flibble

    --- MBSE BBS v1.0.8.4 (Linux-x86_64)
    * Origin: Eweka Internet Services (3:633/280.2@fidonet)