• 0 Posts
  • 2 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle

  • 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: