this post was submitted on 16 Jun 2023
9 points (100.0% liked)
Programming Languages
1186 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
A language designed around the idea of data mutation. Like, just doing data mutation. No functions, no stack, just here's some data and here's how it changes. It's very similar to imperative languages as you might guess, but it basically removes functions from the main data path and simplifies everything which leads to some weird syntax and features.
There are still functions in some ways via a trait system kind of like Rust (also where and polymorphism appears), but it's not quite the same.
I don't really know exactly how to explain it beyond that, so here's a snippet:
Not that
+=
here is not equivalent toa = a + b
, but rather+=
is the name of aNumeric
trait procedure. Using words I might call itadd
. It'sa add b
or with C++-esque syntax it's like(&c)->add(b)
or something.There is a
File
struct in thestd
module and aWrite
trait implemented for&File
s that includes awrite(&Char)
procedure as well as an instance of an&File
called "out." So to write a string of characters to stdout, you dostd.out write <characters>
So from this, I can say that procedures in traits in this language are like mini versions of the stuff under
[Mut]
that you can call with parameters. These procedures can also have embedded C code which is how you interact with external stuff and how the core and standard libraries are implemented.Trait and struct definitions go under
[Type]
and have their own syntaxForcing all logic to be an explicit mutation of a singular datum may end up being the worst way to program ever, but it's at least a different way
EDIT: Conceptually this is the same, but the syntax is a bit different now
Update: I wrote up a quick manual for the language explaining concepts in more depth and reworking the syntax
Here's a couple example programs.
hello_world.mjut
truth_machine.mjut
I think I have it fleshed out enough to get a basic version working. I'll write up a lexer and parser tomorrow (it's after midnight, so actually today lol) probably
Lexer done! On to parser
Parser done. Time for Code Generation. I'm going to transpile to C for now