this post was submitted on 16 Jun 2023
9 points (100.0% liked)
Programming Languages
1190 readers
1 users here now
Hello!
This is the current Lemmy equivalent of https://www.reddit.com/r/ProgrammingLanguages/.
The content and rules are the same here as they are over there. Taken directly from the /r/ProgrammingLanguages overview:
This community is dedicated to the theory, design and implementation of programming languages.
Be nice to each other. Flame wars and rants are not welcomed. Please also put some effort into your post.
This isn't the right place to ask questions such as "What language should I use for X", "what language should I learn", and "what's your favorite language". Such questions should be posted in /c/learn_programming or /c/programming.
This is the right place for posts like the following:
- "Check out this new language I've been working on!"
- "Here's a blog post on how I implemented static type checking into this compiler"
- "I want to write a compiler, where do I start?"
- "How does the Java compiler work? How does it handle forward declarations/imports/targeting multiple platforms/?"
- "How should I test my compiler? How are other compilers and interpreters like gcc, Java, and python tested?"
- "What are the pros/cons of ?"
- "Compare and contrast vs. "
- "Confused about the semantics of this language"
- "Proceedings from PLDI / OOPSLA / ICFP / "
See /r/ProgrammingLanguages for specific examples
Related online communities
- ProgLangDesign.net
- /r/ProgrammingLanguages Discord
- Lamdda the Ultimate
- Language Design Stack Exchange
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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
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 theerror
.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 inand
: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