NGN - Customizable Programming Language

  • FeynmanLogomaker
    21st Aug 2015 Member 1 Permalink
    If any of you guys are really into programming or have ever wanted to desig a programming language, you should check out NGN, a language I'm writing that is designed to be easily modified or extended by the developer.

    The full language reference is in the repo's readme.md, and I'm working on a wiki for it. It runs fine in TPT and I'm going to make a TPT extension for it later this week.

    Right now it's in beta, so I'm looking for people to test it. If you make anything interesting with it, you could post it here so I could check it out, and once it's ready for public release I'm going to be making a website for it where I'll feature any interesting/useful programs or extensions written with it.

    I'm also more than welcome to anyone who wants to help develop it, and if you do you'll get proper credit for any contributions.

    please test this i really need beta testers because im not exactly good at catching bugs

    Edited 3 times by FeynmanLogomaker. Last: 25th Aug 2015
  • Mrprocom
    21st Aug 2015 Moderator 1 Permalink

    ## Dynamic-step for loop
    for $varname : $start, $end [$varname+=$varname/2;] {
    ## do stuff
    };

    Doesn't that seem a little bit weird? shouldn't it be "$start, $end, [$varname+=$varname/2;]" instead?
    Also, you managed to create a language using Lua by yourself :o nice!
  • FeynmanLogomaker
    21st Aug 2015 Member 0 Permalink
    You're right, that would make more sense, that might have even just been a typo.
    And thanks!
  • ChargedCreeper
    21st Aug 2015 Member 1 Permalink

    So a scripting language running in a scripting language. Rofl. Scriptception.

  • mniip
    22nd Aug 2015 Developer 3 Permalink
    What kind of abomination is this...

    There's no tokenizer, no lexer, no parser, no AST. Everything is parsed with fragile pattern matches. The syntax is terrible, unconventional, and counterintuitive. Who in their right mind uses '>' for method calls?
  • FeynmanLogomaker
    22nd Aug 2015 Member 1 Permalink
    That's why it's in beta m8
  • Schmolendevice
    22nd Aug 2015 Member 0 Permalink

    @mniip (View Post)

    Although I myself have not yet managed the time or creativity to write my own compiler, I'd imagine understanding your concerns with code I am now afraid of looking at as per named compiler components which seem like the structures I'd implement if ever doing this from scratch (sigh, why in the world don't I own a dragon book yet after this long?).

  • ChargedCreeper
    22nd Aug 2015 Member 0 Permalink

    FeynmanLogomaker:

    That's why it's in beta m8

     

    Should call it Alpha IMO.

  • mniip
    22nd Aug 2015 Developer 1 Permalink
    @Schmolendevice (View Post)
    compiler/interpreter how-to:

    1. You have a string: local x = concat(123, "moo-456", x)
    2. Iterate over the characters, grouping them semantically as your language requires, obtaining a token stream: [<keyword local> <identifier x> "=" <identifier concat> "(" <number 123> "," <string moo-456> "," <identifier x> ")"]
    3. Do a most likely recursive and sometimes backtracking match of your language's rules over the token stream, obtaining an AST: (local assignment "x" (function call (global "concat") (number 123, string "moo-456", global "x")))

    From here on you can do multiple things:
    a. Interpret the AST. Apply execution semantics to the tree and simulate the variables, function calls, and other stuff.
    b. Pretend that you're executing the AST, but mark the actions you're performing. With some polishing these actions translate directly to assembly.
    c. Do the above, except translate everything to your own made up kind of assembly which you're later going to emulate. This lets us split execution semantics between the compiler part and the executor part in any way we wish. For example in lua, the VM operates on lua datatypes, inherits coercion semantics and metamethod invocation. However the VM doesn't know anything about variables. Compiler translates named variables like 'local x' into numbers on the stack, and globals like "print" into string-ey indexing into the globals table.
    Edited 2 times by mniip. Last: 22nd Aug 2015
  • FeynmanLogomaker
    22nd Aug 2015 Member 0 Permalink
    That's what I'm very slowly building up to, I only released it now because it's capable of running programs