As in /r/ProgrammingLanguages, we will have a thread every month where you can post PL-related projects you are working on. Unlike the main posts, this thread is much more lenient: you should post even if you only have minor updates or something tangentially related to programming languages.

How much progress have you made since last time? What new ideas have you stumbled upon, what old ideas have you abandoned? What new projects have you started? What are you working on?

Once again, feel free to share anything you’ve been working on, old or new, simple or complex, tiny or huge, whether you want to share and discuss it, or simply brag about it - or just about anything you feel like sharing!

The monthly thread is the place for you to engage /c/programming_languages on things that you might not have wanted to put up a post for - progress, ideas, maybe even a slick new chair you built in your garage. Share your projects and thoughts on others’ ideas, and most importantly, have a great and productive month!

Also see: https://www.reddit.com/r/ProgrammingLanguages/comments/13x2iv3/june_2023_monthly_what_are_you_working_on_thread/

  • levovix
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 years ago

    I was trying to create a programming language that doesn’t have a parser. It has only AST nodes. The program is edited only inside a special editor.

    Nodes in the language are defined as

    type Node = ref object
      kind: Node
      childs: seq[Node]
      data: seg[byte]
    

    That is, the node type is literally another node, which allows you to create as many types of nodes as you want without changing the program in any way. Some nodes may be functions.

    For example, this is what the “function” and looks like:

    note that and contains recursion to itself in the error.
    also note that string "false" is just representation of what this constant means, there is no need to create new string “false” every time.

    And this is what the “function” x looks like, the use of which can be seen in and:

    • armchair_progamerOPM
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      You might want to look at Pharo (+ other Smalltalk variants) and Racket. They both have non-text syntax and deep meta-programming “code as data” capabilities. They’re also both very unique and a lot different from even each other.

      In Pharo and other Smalltalks, everything is an object: not just classes and functions, even the GUI and runtime itself. Code is stored in a persistent “image”, opening it in the Pharo IDE is like starting up a VM, and you can modify the environment e.g. to program custom IDE features. See the Wikipedia on Smalltalk and Pharo’s “Discover” page.

      In Racket and other LISPS, everything is an s-expression, and syntax is “quoted” and manipulated by powerful macros (“code as data”). Racket’s macros are powerful enough to add entirely new language features like type systems [2] and object-oriented code, and even entirely new languages with alternate syntax [2]. See “Beautiful Racket”. DrRacket also allows you to embed images and “snips” inside of .rkt files (.rkt files are text, but the embedded content will be encoded and usable in DrRacket).

      There are other examples too, like MPS (DSL creator whose syntax isn’t text) and lambda calculus where everything is a lambda (unnamed function), even numbers. But I think Smalltalk is closest to what you’ve implemented