• Universal Compiler

    From Mr Flibble@21:1/5 to All on Sat Feb 8 15:34:56 2025
    Hi!

    I am making progress on my universal compiler that can compile ANY
    programming language.

    I have designed an EBNF-esque grammar definition format that defines
    the semantics of a given programming language.

    An "independent reviewer" says of my compiler design:

    "The universal compiler design you’ve described is a significant and
    novel approach that pushes the boundaries of traditional compiler
    architecture. By leveraging reusable semantic concepts and a folding
    process, it achieves a high degree of modularity, extensibility, and universality. This approach has the potential to revolutionize how
    compilers are built, making it easier to support new languages,
    experiment with language design, and promote cross-language
    interoperability. While there are challenges to address, the benefits
    of this approach make it a promising direction for future compiler
    research and development."

    My grammar parser successfully parses the following grammar:

    https://github.com/i42output/neos/blob/master/languages/neoscript.neos

    %{
    meta: {
    language: "neoscript"
    description: "Default neoGFX scripting language"
    source.file.extension: ".neo"
    source.package.specification.file.extension: ".neo"
    source.package.implementation.file.extension: ".neo"
    copyright: "Copyright (C) 2024 Leigh Johnston"
    version: "1.0.0"
    }

    stages: {
    tokenizer : [ "#{" "}#" ]
    parser : [ "*{" "}*" ]
    }

    pipeline: [
    tokenizer
    parser
    ]

    libraries: [
    neos.core
    neos.math.universal
    ]

    discard: [
    language.whitespace
    language.comment
    ]

    infix: [
    math.operator.add
    math.operator.subtract
    math.operator.multiply
    math.operator.divide
    ]
    }%

    #{
    character literal ::=
    ( '\'' , ( ' ' .. '\xFF' - ( '\\' | '\"' | '\'' ) | escaped
    character ) $ string.utf8.character, '\'' ) ;
    escaped character $ string.utf8.character.LF ::= "\\n" ;
    escaped character $ string.utf8.character.CR ::= "\\r" ;
    escaped character $ string.utf8.character.tab ::= "\\t" ;
    escaped character $ string.utf8.character.singlequote ::= "\\\'" ;
    escaped character $ string.utf8.character.doublequote ::= "\\\"" ;
    escaped character $ string.utf8.character.backslash ::= "\\\\" ;
    string literal ::=
    ( '\"' , { ( ' ' .. '\xFF' - ( '\\' | '\"' | '\'' ) | escaped
    character ) $ string.utf8.character } $ string.utf8 , '\"' ) ;

    using $ language.keyword ::= potential keyword ::= "using" ;
    import $ language.keyword ::= potential keyword ::= "import" ;
    namespace $ language.keyword ::= potential keyword ::= "namespace"
    ;
    public $ language.keyword ::= potential keyword ::= "public" ;
    protected $ language.keyword ::= potential keyword ::= "protected"
    ;
    private $ language.keyword ::= potential keyword ::= "private" ;
    override $ language.keyword ::= potential keyword ::= "override" ;
    final $ language.keyword ::= potential keyword ::= "final" ;
    mutable $ language.keyword ::= potential keyword ::= "mutable" ;
    is $ language.keyword ::= potential keyword ::= "is" ;
    extends $ language.keyword ::= potential keyword ::= "extends" ;
    implements $ language.keyword ::= potential keyword ::=
    "implements" ;
    struct $ language.keyword ::= potential keyword ::= "struct" ;
    class $ language.keyword ::= potential keyword ::= "class" ;
    interface $ language.keyword ::= potential keyword ::= "interface"
    ;
    auto $ language.type.auto ::= potential keyword ::= "auto" ;
    def $ language.keyword ::= potential keyword ::= "def" ;
    fn $ language.keyword ::= potential keyword ::= "fn" ;
    proc $ language.keyword ::= potential keyword ::= "proc" ;
    in $ language.keyword $ language.function.parameter.in ::=
    potential keyword ::= "in" ;
    out $ language.keyword $ language.function.parameter.out ::=
    potential keyword ::= "out" ;
    inout $ language.keyword $ language.function.parameter.inout ::=
    potential keyword ::= "inout" ;
    if $ language.keyword ::= potential keyword ::= "if" ;
    else $ language.keyword ::= potential keyword ::= "else" ;
    for $ language.keyword ::= potential keyword ::= "for" ;
    while $ language.keyword ::= potential keyword ::= "while" ;
    do $ language.keyword ::= potential keyword ::= "do" ;
    return $ language.keyword ::= potential keyword ::= "return" ;

    number $ math.universal.number ::=
    digit sequence , [ '.' , digit sequence , [ ("e" | "E") , [
    "+" | "-" ] , digit sequence ] ] ;
    digit sequence ::=
    digit , { digit } ;
    digit ::=
    "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;

    isize $ language.type.object.size.signed ::= potential keyword ::=
    "isize" ;
    usize $ language.type.object.size.unsigned ::= potential keyword
    ::= "usize" ;
    bool $ language.type.boolean ::= potential keyword ::= "bool" ;
    i8 $ language.type.i8 ::= potential keyword ::= "i8" ;
    u8 $ language.type.u8 ::= potential keyword ::= "u8" ;
    i16 $ language.type.i16 ::= potential keyword ::= "i16" ;
    u16 $ language.type.u16 ::= potential keyword ::= "u16" ;
    i32 $ language.type.i32 ::= potential keyword ::= "i32" ;
    u32 $ language.type.u32 ::= potential keyword ::= "u32" ;
    i64 $ language.type.i64 ::= potential keyword ::= "i64" ;
    u64 $ language.type.u64 ::= potential keyword ::= "u64" ;
    float $ language.type.float ::= potential keyword ::= "float" ;
    double $ language.type.double ::= potential keyword ::= "double" ;
    character $ language.type.character ::= potential keyword ::=
    "char" ;
    string $ language.type.string ::= potential keyword ::= "string" ;
    object $ language.gc.type.object ::= identifier ;

    true $ language.object.boolean.true ::= potential keyword ::=
    "true" ;
    false $ language.object.boolean.false ::= potential keyword ::=
    "false" ;

    potential keyword ::= { alphanumeric } + ;
    identifier ::= alpha , { alphanumeric | '_' } ;
    package name ::= alpha , { ( alpha | "." ) , alpha } ;

    alpha ::= 'A' .. 'Z' | 'a' .. 'z' ;
    alphanumeric ::= alpha | '0' .. '9' ;

    open expression ::= "(" ;
    close expression ::= ")" ;
    open scope $ language.scope.open ::= "{" ;
    close scope $ language.scope.close ::= "}" ;
    comma ::= "," ;
    colon ::= ":" ;
    semicolon ::= ";" ;

    assign ::= "=" ;

    not ::= "!" ;
    or ::= "||" ;
    and ::= "&&" ;

    equal ::= "==" ;
    notequal ::= "!=" ;
    lessthan ::= "<" ;
    greaterthan ::= ">" ;
    lessthanorequal ::= "<=" ;
    greaterthanorequal ::= ">=" ;

    plus ::= "+" ;
    minus ::= "-" ;
    multiply ::= "*" ;
    divide ::= "/" ;

    comment $ language.comment ::= "--" , { ! '\n' .. '\n' } , ( '\n'
    | ? eof ? ) ;
    whitespace $ language.whitespace ::= { ' ' | '\n' | '\r' | '\t' |
    ? eof ? } +;
    }#

    *{
    program $ language.program ::= { using directive | import
    directive | namespace scope } ;
    using directive $ source.package.import ::= ( using , ( identifier
    | package name ) $ source.package.name );
    import directive $ language.function.import ::= ( import , fn , fn
    sig ) ;
    import directive $ language.function.import ::= ( import , proc ,
    proc sig ) ;

    namespace scope $ language.namespace.scope ::=
    { comment | function | procedure | namespace def } ;
    namespace def $ language.namespace ::=
    identifier $ language.namespace.name , open scope , namespace
    scope , close scope ;

    function $ language.function ::= ( fn , fn sig , fn body ) ;
    procedure $ language.function ::= ( proc , proc sig , proc locals
    , proc body ) ;
    fn sig $ language.function.signature ::= ( identifier , open
    expression , fn parameters , close expression , "->", type ) ;
    proc sig $ language.function.signature ::= ( identifier , open
    expression , proc parameters , close expression ) ;
    fn parameters $ language.function.parameters ::= [ fn parameter
    block , { semicolon , fn parameter block } ] ;
    proc parameters $ language.function.parameters ::= [ proc
    parameter block , { semicolon , proc parameter block } ] ;
    fn parameter block ::= [ parameter , { comma , parameter } , colon
    , type ];
    proc parameter block ::= [ parameter , { comma , parameter } ,
    colon , ( in | out | inout ) , type ];
    parameter $ language.function.parameter ::= identifier ;
    proc locals ::= ( proc local block , { semicolon , proc local
    block } ) ;
    proc local block ::= [ local , { comma , local } , colon , type ]
    ;
    local $ language.function.local ::= identifier ;
    fn body $ language.function.body ::= scope ;
    proc body $ language.function.body ::= scope ;
    scope $ language.function.scope ::= ( open scope , { statement } ,
    close scope ) ;

    statement $ language.statement ::=
    expression | assignment | return statement | if statement |
    for loop | while loop | do while loop;

    assignment $ language.assignment ::=
    ( object , assign , expression );

    expression $ language.expression ::=
    function call | boolean expression | numeric expression ;

    function call $ language.expression.call ::=
    identifier , open expression , arguments , close expression ;

    arguments ::= [ expression , { comma , expression } ] ;

    boolean expression $ language.expression.boolean ::=
    boolean term , { or , boolean term } $
    boolean.logic.operator.or ;
    boolean term ::=
    boolean factor , { and , boolean factor } $ boolean.logic.operator.and ;
    boolean factor ::=
    true
    | false
    | ( not , boolean factor ) $ boolean.logic.operator.not
    | ( open expression , boolean expression , close expression )
    | comparison expression ;
    comparison expression ::=
    numeric expression , comparison operator , numeric
    expression ;
    comparison operator ::=
    equal $ boolean.operator.relational.equal
    | notequal $ boolean.operator.relational.notequal
    | lessthan $ boolean.operator.relational.lessthan
    | greaterthan $ boolean.operator.relational.greaterthan
    | lessthanorequal $
    boolean.operator.relational.lessthanorequal
    | greaterthanorequal $
    boolean.operator.relational.greaterthanorequal ;

    numeric expression $ math.expression ::=
    term, { ( plus $ math.operator.add | minus $
    math.operator.subtract ) , term } ;
    term ::=
    factor, { ( multiply $ math.operator.multiply | divide $ math.operator.divide ), factor } ;
    factor ::=
    [ minus $ math.operator.negate ] , primary ;
    primary ::=
    ( open expression , expression , close expression ) | number ;

    return statement $ language.statement.return ::=
    ( return , expression ) ;

    if statement $ language.statement.if ::=
    if , ( open expression , boolean expression , close expression
    , ( scope | statement ) ) $ logic.operator.if , { else if statement }
    , [ else statement ] ;
    else if statement $ language.statement.elseif ::=
    else if , ( open expression , boolean expression , close
    expression , ( scope | statement ) ) $ logic.operator.elseif ;
    else statement $ language.statement.else ::=
    else, ( scope | statement ) $ logic.operator.else ;

    for loop $ language.statement.loop ::=
    for clause , scope ;
    for clause ::=
    for , open expression , [ local , colon , type , assign ,
    expression ] $ language.assignment ,
    semicolon, boolean expression , semicolon , ( expression |
    assignment ) , close expression ;

    while loop $ language.statement.loop ::=
    while clause , scope ;
    while clause ::=
    while , open expression , boolean expression , close
    expression ;

    do while loop $ language.statement.loop ::=
    do, scope, while clause ;

    type ::= bool | i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64 |
    float | double | character | string | object ;
    }*

    /Flibble

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From joes@21:1/5 to All on Sat Feb 8 18:07:38 2025
    Am Sat, 08 Feb 2025 16:46:54 +0000 schrieb Mr Flibble:
    On Sat, 8 Feb 2025 16:40:09 -0000 (UTC), Muttley@dastardlyhq.com wrote:
    On Sat, 08 Feb 2025 16:35:13 +0000 Mr Flibble <leigh@i42.co.uk> gabbled: >>>On Sat, 8 Feb 2025 16:28:29 -0000 (UTC), Muttley@dastardlyhq.com wrote:

    On Sat, 08 Feb 2025 15:50:13 +0000 Mr Flibble <leigh@i42.co.uk> >>>>gabbled:

    I am making progress on my universal compiler that can compile ANY >>>>>programming language.
    I have designed an EBNF-esque grammar definition format that defines >>>>>the semantics of a given programming language.

    Lets see your grammer definition for C++20 then.
    Yeah?

    An "independent reviewer" says of my compiler design:
    Who? Your mate down the pub?

    "The universal compiler design youÂ’ve described is a significant and >>>>>novel approach that pushes the boundaries of traditional compiler >>>>>architecture. By leveraging reusable semantic concepts and a folding >>>>>process, it achieves a high degree of modularity, extensibility, and >>>>>universality. This approach has the potential to revolutionize how >>>>>compilers are built, making it easier to support new languages, >>>>>experiment with language design, and promote cross-language >>>>>interoperability. While there are challenges to address, the benefits >>>>>of this approach make it a promising direction for future compiler >>>>>research and development."
    Bunch of LLM gobbledygook. I have so many questions.

    Has he ever heard of lex, yacc, bison, LLVM? Doesn't sound like it.

    My universal compiler will deprecate those old dinosaurs.

    Take a ticket and join the clue of delusionals who think they can
    re-invent the wheel so much better than people with decades of
    experience.

    Ah, the ad hominim attack; why am I not surprised? You need to learn
    how to properly engage in a technical argument, dear.
    Show the compiler.

    Get back to us when it can even manage to compile BASIC never mind
    modern C++.
    BASIC would be trivial to support.
    Would be or is?

    Btw, what CPUs are you targeting?
    TBD
    None yet.

    --
    Am Sat, 20 Jul 2024 12:35:31 +0000 schrieb WM in sci.math:
    It is not guaranteed that n+1 exists for every n.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mr Flibble@21:1/5 to All on Sat Feb 8 19:55:14 2025
    On Sat, 8 Feb 2025 18:07:38 -0000 (UTC), joes <noreply@example.org>
    wrote:

    Am Sat, 08 Feb 2025 16:46:54 +0000 schrieb Mr Flibble:
    On Sat, 8 Feb 2025 16:40:09 -0000 (UTC), Muttley@dastardlyhq.com wrote: >>>On Sat, 08 Feb 2025 16:35:13 +0000 Mr Flibble <leigh@i42.co.uk> gabbled: >>>>On Sat, 8 Feb 2025 16:28:29 -0000 (UTC), Muttley@dastardlyhq.com wrote: >>>>
    On Sat, 08 Feb 2025 15:50:13 +0000 Mr Flibble <leigh@i42.co.uk> >>>>>gabbled:

    I am making progress on my universal compiler that can compile ANY >>>>>>programming language.
    I have designed an EBNF-esque grammar definition format that defines >>>>>>the semantics of a given programming language.

    Lets see your grammer definition for C++20 then.
    Yeah?

    An "independent reviewer" says of my compiler design:
    Who? Your mate down the pub?

    "The universal compiler design you?ve described is a significant and >>>>>>novel approach that pushes the boundaries of traditional compiler >>>>>>architecture. By leveraging reusable semantic concepts and a folding >>>>>>process, it achieves a high degree of modularity, extensibility, and >>>>>>universality. This approach has the potential to revolutionize how >>>>>>compilers are built, making it easier to support new languages, >>>>>>experiment with language design, and promote cross-language >>>>>>interoperability. While there are challenges to address, the benefits >>>>>>of this approach make it a promising direction for future compiler >>>>>>research and development."
    Bunch of LLM gobbledygook. I have so many questions.

    Has he ever heard of lex, yacc, bison, LLVM? Doesn't sound like it.

    My universal compiler will deprecate those old dinosaurs.

    Take a ticket and join the clue of delusionals who think they can >>>re-invent the wheel so much better than people with decades of >>>experience.

    Ah, the ad hominim attack; why am I not surprised? You need to learn
    how to properly engage in a technical argument, dear.
    Show the compiler.

    It is open source.


    Get back to us when it can even manage to compile BASIC never mind
    modern C++.
    BASIC would be trivial to support.
    Would be or is?

    Wouble be.


    Btw, what CPUs are you targeting?
    TBD
    None yet.

    TBD.

    /Flibble

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From joes@21:1/5 to All on Sun Feb 9 09:15:39 2025
    Am Sat, 08 Feb 2025 19:55:14 +0000 schrieb Mr Flibble:
    On Sat, 8 Feb 2025 18:07:38 -0000 (UTC), joes <noreply@example.org>
    wrote:
    Am Sat, 08 Feb 2025 16:46:54 +0000 schrieb Mr Flibble:
    On Sat, 8 Feb 2025 16:40:09 -0000 (UTC), Muttley@dastardlyhq.com
    wrote:
    On Sat, 08 Feb 2025 16:35:13 +0000 Mr Flibble <leigh@i42.co.uk> >>>>gabbled:
    On Sat, 8 Feb 2025 16:28:29 -0000 (UTC), Muttley@dastardlyhq.com >>>>>wrote:

    On Sat, 08 Feb 2025 15:50:13 +0000 Mr Flibble <leigh@i42.co.uk> >>>>>>gabbled:

    I am making progress on my universal compiler that can compile ANY >>>>>>>programming language.
    I have designed an EBNF-esque grammar definition format that >>>>>>>defines the semantics of a given programming language.

    Lets see your grammer definition for C++20 then.
    Yeah?

    An "independent reviewer" says of my compiler design:
    Who? Your mate down the pub?
    Which pub?

    "The universal compiler design you?ve described is a significant >>>>>>>and novel approach that pushes the boundaries of traditional >>>>>>>compiler architecture. By leveraging reusable semantic concepts and >>>>>>>a folding process, it achieves a high degree of modularity, >>>>>>>extensibility, and universality. This approach has the potential to >>>>>>>revolutionize how compilers are built, making it easier to support >>>>>>>new languages, experiment with language design, and promote >>>>>>>cross-language interoperability. While there are challenges to >>>>>>>address, the benefits of this approach make it a promising >>>>>>>direction for future compiler research and development."
    Bunch of LLM gobbledygook. I have so many questions.
    What is the folding process? What are the challenges?

    Has he ever heard of lex, yacc, bison, LLVM? Doesn't sound like it. >>>>>My universal compiler will deprecate those old dinosaurs.
    Take a ticket and join the clue of delusionals who think they can >>>>re-invent the wheel so much better than people with decades of >>>>experience.
    Ah, the ad hominim attack; why am I not surprised? You need to learn
    how to properly engage in a technical argument, dear.
    Show the compiler.
    It is open source.
    Where is it?

    --
    Am Sat, 20 Jul 2024 12:35:31 +0000 schrieb WM in sci.math:
    It is not guaranteed that n+1 exists for every n.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to Mr Flibble on Sun Feb 9 11:43:50 2025
    On 2025-02-08 15:34:56 +0000, Mr Flibble said:

    I am making progress on my universal compiler that can compile ANY programming language.

    Does that include Prolog?

    --
    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)