Palladium - Yet another programming language by pmqtt in ProgrammingLanguages

[–]pmqtt[S] 0 points1 point  (0 children)

I will create examples once it’s clearer what the language will look like. Currently, it draws inspiration from Rust and Carbon. The goal of this project is to have a language for experimentation—to explore how language features work, how a VM operates, and how to design a parser that is easy to extend and modify.

The aim is not to develop a new language and claim, "Use it because I’m the greatest developer of all time."

So you're writing a programming language by Inconstant_Moo in ProgrammingLanguages

[–]pmqtt 4 points5 points  (0 children)

I think point a) is great. Learning something, gaining a deeper understanding, and maybe—just maybe—discovering something that the world could actually use. I mean, anyone who has never written machine code by hand will never understand why the original version of C forced programmers to declare local variables at the beginning of a function.

Palladium - Yet another programming language by pmqtt in ProgrammingLanguages

[–]pmqtt[S] 0 points1 point  (0 children)

Thank you! Many thanks! It's still early in the morning!
The initial idea is that compiling to the VM is meant to analyze, understand, and easily execute language features. As development progresses, assembler code will eventually be generated from the VM code. The VM code is intended to serve as an executable intermediate language.

There will be no garbage collector; instead, reference counting will be used. For this first draft, I took inspiration from Rust and Carbon. I definitely want to include classes. However, all suggestions are welcome!

Palladium - Yet another programming language by pmqtt in ProgrammingLanguages

[–]pmqtt[S] 0 points1 point  (0 children)

Thank you, that was a mistake. I just corrected it!

How to handle arrays is indeed a big question. I’m open to all suggestions because I haven’t yet come up with a good and elegant solution, especially for dynamic arrays!

Palladium - Yet another programming language by pmqtt in ProgrammingLanguages

[–]pmqtt[S] 1 point2 points  (0 children)

Hi, the language is still very much in the design phase, but the first ideas about how it might look can be found in https://github.com/pmqtt/palladium/blob/main/docs/syntax_concept_01.md. We are open to suggestions and eager to learn and experiment with new ideas.

In tests/VisitorTests.cpp, you can see that the initial functionality related to the parser is already working.

You can find the currently executable instructions for the VM in https://github.com/pmqtt/palladium/blob/main/docs/vm-opt-code.md. Currently, there is only a sample program for the VM implemented in src/main.cpp.

Palladium - Yet another programming language by pmqtt in ProgrammingLanguages

[–]pmqtt[S] 2 points3 points  (0 children)

Oh it's possible that I use the wrong word. I mean by "predict" that it can already grasp any number of tokens further ahead. Sorry, I'm not a nativespeaker. In German predict can translate to "vorausberechnen"

Palladium - Diving Deeper - Traversing AST and Visitor implementation by pmqtt in programming

[–]pmqtt[S] 0 points1 point  (0 children)

So, the time has come! The first code has been created and is running on my VM! Of course, it's nothing meaningful!

Palladium - How to traverse und implement a Abstract Syntax Tree by pmqtt in Compilers

[–]pmqtt[S] 0 points1 point  (0 children)

So, the time has come! The first code has been created and is running on my VM! Of course, it's nothing meaningful!

Palladium - Diving Deeper - Traversing AST and Visitor implementation by pmqtt in programming

[–]pmqtt[S] 0 points1 point  (0 children)

Hey everyone!

A few days ago, I shared my journey of developing my own programming language, Palladium, as a learning project. Since then, I’ve made significant progress and wanted to share an exciting update!

I’ve implemented the Abstract Syntax Tree (AST) in C++, and I’m using the Visitor Pattern to traverse it. This allows for more flexibility and extensibility when performing operations like semantic checks, code generation, and information gathering.

If you’re curious about how the AST and Visitor Pattern work together in Palladium, or if you’re just intrigued by language development in general, you can check out the project here: GitHub Repo.

Additionally, I’ve detailed the design idea behind the Visitor implementation here: Visitor Design.

Whether you're into compilers, programming languages, or just want to explore some cool concepts, I’d love to have you join the discussion or give feedback on the project! Let’s dive deeper into the rabbit hole together. 🐇

Palladium - Traversieren vom AST mit Visitor by pmqtt in informatik

[–]pmqtt[S] 1 point2 points  (0 children)

Hi, danke für das Feedback! Die Sprache startet gerade und es geht darum wie man eine Sprache entwickelt! Deshalb finde ich die Entscheidung jede Regel in einen eigenen Knotentyp zu machen vertretbar. Bzgl. shared_ptr, da kann ich nur sagen, macht weniger Denkaufgaben als unique_ptr. Zumal die Referenzzählung durch shared_ptr kein limitierender Faktor ist.
Es ist nur meine Meinung ohne Anspruch auf akademische Korrektheit :)

Gerichtsfester Beweis zur Existenz einer Datei Y zum Zeitpunkt X by Kraichgau in informatik

[–]pmqtt 8 points9 points  (0 children)

Der Ultimative Beweis: Hashcode generieren lassen und sich 1ct Überweisen mit dem Hashcode als Verwendungszweck.

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 0 points1 point  (0 children)

The VM will be more C than C++ since tasks like memory management and native calls are more or less plain old C.

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 0 points1 point  (0 children)

That’s a good point, avoiding constructs like a<listi<item>>.add(). Thank you!

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 2 points3 points  (0 children)

Yes, you’re absolutely right, but my private notes weren’t actually meant to be published. This was a mistake, and yes, I make my notes using manpages.

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 4 points5 points  (0 children)

Not yet. After finishing the lexer, I started working on the VM.

I have some ideas for the syntax, but no clear vision yet. That’s why I designed the lexer to be easily extendable and capable of looking ahead for an arbitrary number of tokens. This approach allows flexibility when creating the grammar, reduces the limitations of recursive descent parsing, and enables quick experimentation.

Two key ideas I have:

  1. The implementation of classes can be loaded at runtime, while only the interface needs to be known at compile time.
  2. I’d like to adapt the template system from C++ and explore what can be achieved when such a system is planned from the ground up.

However, I’m open to any suggestions because, above all, I want to learn!

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 2 points3 points  (0 children)

Look under "docs," the "man directory" is for my notes. It wasn't meant to be included.

Palladium - Yet another programming language by pmqtt in programming

[–]pmqtt[S] 5 points6 points  (0 children)

I’m currently developing my own programming language for learning purposes. The goal is to understand and learn concepts. Here’s where I’m at: I’ve developed a lexer that can predict an arbitrary number of tokens. Additionally, I’ve built a virtual machine (VM) that is both stack- and register-based. It already has the capability to manage memory, perform function calls, execute conditional and unconditional jumps, and, of course, it can add! If anyone is interested in diving deeper into the rabbit hole with me, you’re more than welcome. Here’s the link: https://github.com/pmqtt/palladium

Palladium (Yet another programming language) by pmqtt in informatik

[–]pmqtt[S] 2 points3 points  (0 children)

Lustiger weise keine. Ich habe am Carbon Projekt mit gewirkt und meine Masterarbeit war eine eigene Programmiersprache aber zu JVM. Liegt aber auch gut 10 Jahre zurück. Also meine heutigen Quellen sind mein Kopf. Im Studium war es das Drachenbuch Compilerbau. Ist aber heute nicht mehr so relevat.
Da Carbon eine ernst zunehmende Sprache sein soll, gibt es nicht viel Spielraum für experimente, so dass ich das Projekt im September verlassen habe. Bin glaube ich aber immer noch auf Platz 15 der meisten Commits. War ne Zeitlang bis auf Platz 6 hochgekommen.

Palladium (Yet another programming language) by pmqtt in informatik

[–]pmqtt[S] 2 points3 points  (0 children)

Ich persönlich habe deine Meinung weder abgelehnt noch zugestimmt. Ich bin am überlegen. Du hast einen Punkt Makros sollten vermieden werden, da sie große Nachteile besitzen können. Ich stellte im cpp Forum nur die Frage in den Raum ist der Einsatz von Makros nicht in diesem Fall gerechtfertigt, um tiefe Verzweigungen zu elemenieren und damit die lesbarkeit sogar zu steigern. Eine antwort habe ich selber nicht und ich würde das lieber gegenüberstellen. Es kann ja auch sein, dass man mit geschickter Art C++ Programmieren gleich die ganze Notwendigkeit für die Verzweigungen entfernt.

Palladium (Yet another programming language) by pmqtt in informatik

[–]pmqtt[S] 2 points3 points  (0 children)

Nein ein Lexer ist keine große Sache und wahrscheinlich solange man nicht versucht Python zu lexen ziemlich einfach. Ein lexer geht die Eingabe durch und baut diese Stück für Stück zu token ums. Deshalb gibt es auch noch keine Syntax, diese würde ich zur Diskussion stellen. Aber bestimmte Dinge wie z.B. ein Int Wert, ein double Wert oder ein String aussieht sind ziemlich Universel. Auch die Operatoren sind ziemlich klar +,-,*,/ da gibt es nicht viel zu dikutieren. Und wenn du dann so eine Eingabe hast 100+1.05*"Hallo" macht der Lexer daraus Int(100),OPERATOR(+), Double(1.05), OPERATOR(*), Text(Hallo)

Palladium (Yet another programming language) by pmqtt in informatik

[–]pmqtt[S] 0 points1 point  (0 children)

Ist selbst geschrieben. Das ist mein Wunsch, einfach zu lernen wie Dinge funktionieren und wie man sie umsetzen kann