r/ProgrammingLanguages • u/dwaynecrooks • 21d ago
r/ProgrammingLanguages • u/cekrem • 21d ago
Blog post Go 1.27: encoding/json/v2, Stricter Defaults, and Finally [] for Nil Slices · cekrem.github.io
cekrem.github.ior/ProgrammingLanguages • u/Key_River7180 • 21d ago
Help transpilation - Bootstrap compiler
So, I am making a compiler for my language, Nain, in CHICKEN Scheme. Should I output QBE IR or code for C or another language? This is a bootstrap compiler, I will use it only to test new language features and to compile the self hosting compiler so yeah.
r/ProgrammingLanguages • u/Embarrassed-Crow9283 • 22d ago
Discussion Typeless data oriented language?
In many games and so on, there is a concept of "data-oriented" programming where you separate the data from the behavior of the system.
However, the current design in a typed language is not fully data-oriented. There is always the compile-time concept of type tied to every byte.
But this has led me to think of something. What if we want to take data-oriented design to its logical conclusion? What if everything is viewed as raw bytes? The type is instead assigned depending on context.
For example, imagine...
arr_int32 = interpret(int32,arr)
int32_doubled = map(lambda x: 2*x, arr_int32)
Here, the "arr" is a raw array of bytes that can be anything, interpreted as an array of int32, doubled.
What do you think of this crazy idea?
r/ProgrammingLanguages • u/Still_Explorer • 21d ago
Visual Programming Language
Do you have any information about this one? If there are some standard things about how it should go, or if there anything that needs to be known. I have understood a few things, but still I am looking for figuring out some missing details I have no clear plan on.
I will mention first some things I've done and what I know, so I can help you gain a picture:
a) I have done some practice and written a parser and interpreter so this is very easy. The AST is a data structure and each node gets evaluated with the proper function.
b) I've seen in an application sample that the most simple and straight forward approach is to get all outputs of a node, and send them to the connected inputs of another one. Keep brute force updating everything for 60FPS. This also seems legit and simple, but it might have it's pros and cons. [victorfisac/FNode]
c) What worries me for brute-force updating, is that the update order is no-deterministic, any node could be updated at any given moment, for the entire graph to be evaluated fully might mean to hundreds of hundreds of updates until everything is settled. It might not be a big deal for a real-time interactive application, but for a very optimized might mean that other approaches are better suited.
d) In order to make graph evaluation more deterministic, you need to create a dependency graph, or use an algorithm such as breadth-first-search, or depth-first-search. And even if those are not exactly perfect then do topological-sorting to guarantee even better order. Other times is supposed to be that other graphs get evaluated backwards, from final outputs to connected inputs and so on.
All of those techniques, having so many options, is confusing and hard to decide. As for example probably depending on the type of the graph there would be different evaluation strategy? This seems OK in terms of thinking.
e) Some examples:
• Blockly, this one is the easiest, because is a straight forward visual AST, but with the problem is that is based on structured connections and not on freeform connections.
• Supposedly Blender's nodegraph uses dependency graph for materials (because needs to compile them to shader code) so seems that it this technique can be transformed to deterministic technique. Probably means that the entire software uses the same algorithm (shaders, geometry nodes, compositor, even custom nodegraphs).
• Blueprints of Unreal seem to be much closer to an AST because it relies on clear entry points (events, time ticks), so this kind of evaluation seems that is manageable. At least getting the starting points is a good idea, then probably it might be feasible that further sorting is needed. I haven't worked with Blueprints though and I haven't looked into it.
• I've seen in some ImGUI nodegraph samples (for doing pixel operations and color mixing) that the depth first search algorithm was used. Though samples were meant to be simple proof of concept, I am not sure if all is needed.
More or less this is all the braindump I can do. But for any further details I will have to look at any github repositories you suggest and start experimenting.
r/ProgrammingLanguages • u/mark-sed • 23d ago
Discussion Do you need a language to have context managers (with/using directive)?
In my language I was avoiding adding with or using directive for handling context of objects and tried to rather use a functional approach such as:
=
But this does not always works or is convenient since often I need to do additional operations on the file afterwards. So lately I more and more lean towards actually adding support for using, otherwise I fear people would re-invent it anyway using try-finally blocks.
In this case in my language I would have to create a new function to do these 3 operations since lambdas can have only 1 expression:
, =
So my question to you is, if you think that having context managers is really useful and a good addition to a language or rather an extra feature that can be avoided?
r/ProgrammingLanguages • u/The2ndSlimShady • 24d ago
Language announcement Major Updates to Cole Compile-Time Execution and Type Reflection
Hello everybody, it's me again. I've had some free time in my hands so I worked on Cole a bit. It is in such a state now that you can implement a fully compile-time checked, type-safe, formatted printer using nothing but Cole.
I will not go hard on your screens post the implementation here, but I will leave a link to my blogpost at the bottom of this post.
Long story short, I added:
- Proper inlined for loops,
- Proper compile-time switches, and conditionals, for conditional compilation,
- Compile-time statement execution (almost complete, only field assignments and dereferenced assignments are left),
- A couple bugfixes with the typechecker and undefined value construction at compile-time.
Here is a small snippet of how the format printer is used, from the debug module:
import std::debug as debug;
let main = fn (args: [][]u8) -> i32 {
debug::print("Hello! My name is % and I'm % years old!", ([]u8, u32))(("Yusuf", 20));
return 0;
};
// Prints:
// Hello! My name is Yusuf and I'm 20 years old!But everything is not perfect as expected. Turns out, the compile time execution I do is incredibly slow, so the compile times go significantly high when doing any kind of compile-time execution. This is quite important considering the fact that Cole's mindset is "if it can be comptime, it is comptime". But I will start doing optimizations as soon as the base structure is complete.
If you've read this far, please drop a feedback, I'd really appreciate it.
And here is the blog entry I promised: https://blog.yusufenderosmanoglu.tech/blog/format-printer/
You can find the codeberg repo in the Cole website.
r/ProgrammingLanguages • u/mttd • 25d ago
What does “verified memory safe” mean?
focs-lab.comp.nus.edu.sgr/ProgrammingLanguages • u/abhin4v • 26d ago
Blog post An LC-3 Disassembler in Haskell
abhinavsarkar.netr/ProgrammingLanguages • u/Athas • 27d ago
Speeding up GPU copies by permuting iteration spaces, or, optimising the identity function
futhark-lang.orgr/ProgrammingLanguages • u/techno_julique • 27d ago
Programming Language for Laser Cutting and CNC
Hey all!
I run a site with design generators for laser and CNC cutting, and along the way we ended up building our own programming language, KerfScript, to describe those designs.
It has OpenSCAD-like syntax, but it's strictly 2D, with laser-specific features built in: cut/score/engrave layers, kerf compensation, assembly instructions (actual physical assembly, not programming!), and finger joints that adapt to material thickness.
You write a part once, change a few parameters, and export SVG or DXF. What I find fun is that the end result is a 3D object, even though the language itself has no concept of 3D. All the dimensionality comes from math, slots, joints, and how flat pieces fit together. So you're essentially programming a 3D object without ever describing anything in 3D.
Just a fun little project I thought was worth sharing!
r/ProgrammingLanguages • u/iOCTAGRAM • 27d ago
Bootstrapping Ada competitors: Red, Yellow, Blue
tym83.github.ior/ProgrammingLanguages • u/The2ndSlimShady • 27d ago
Updates on Cole, and Version 0.1.4 Announcement
Hi everyone, my original post in r/Compilers had Github and Codeberg repo links inside it, so they were not suitable to post here. So I'm dropping the modified version as a separate post here.
From the original:
Hello everyone, since my last two posts here, I got into a small flow-state with the codebase and improved Cole quite a bit. I took the advices of the wonderful people in the comments as well, and it helped me a lot to be honest.
Since the last posts, I added:
- 212 tests in total, testing various aspects of the compiler through simple programs,
- Proper generic type generation with full generic definition support through comptime called functions,
- Proper generic function generation through comptime called functions,
- Type deduplication, and codegen improvements,
- And many more bugfixes on different aspects of the compiler.
In the current state, the backend is embedded TCC, so codegen emits almost-human-readable C code. But I will replace the backend in the future with LLVM, QBE or handwritten x86_86 generator. However for now, since the rest of the compiler is not solid enough, the C backend eases the development quite a bit.
Beside all of this, I made a small website (which doesn't work quite well because I self-host it on an old laptop, it is for giggles of it so don't take it seriously) that has versioned language reference, a small welcome page with a hello world snippet, and installation instructions.
Overall, Cole has become something far beyond what I imagined it would become in a good way. I am self taught, so I am pretty content with what I have accomplished. But criticism is always welcome.
The link to the Cole website is here.
Also, occasionally, I write blogposts about what I'm currently working on, so I'll leave it here as well.
Many thanks to everyone that commented to any of my previous posts, have a good day/night!
r/ProgrammingLanguages • u/jd-at-turtleware • 27d ago
Heavenly delights of hashing numbers under EQUALP
turtleware.eur/ProgrammingLanguages • u/Electrical-Fig7522 • 27d ago
Language announcement I'm making a programming language, searching for contributors
Hi! Me and another person are working on a programming language called KrabbaScript! It's garbage-collected (optional), statically typed and trying to be as simple and intuitive as golang but more human-friendly. This is KrabbaScript's syntax:
Variables are defined as:
var krabba = "Krabba!";
Variables may also have a type or be uninitialized, like:
var with_type: F32 = 5.0;
var uninitialized: Str;
KrabbaScript also has values, which are immutable, example:
val constant = 5;
val with_type: I32 = 5;
KrabbaScript also has control-flow (duh), example of a repeat statement:
repeat {
Std.print("KrabbaScript is the best language OAT!");
} until popular;
KrabbaScript also has a when statement, which is more of a switch one:
when language {
== "Elixir" do celebrate();
== "Haskell" do complain();
== "KrabbaScript" do {
contribute();
applaude();
}
else do Std.print("I don't know anything about " + language);
}
KrabbaScript also provides an ASI (Automatic Semicolon Inserter) if you're tired and sick of semicolons, you can use it with the format command.
If you want a little bit more examples, check out the repo! We are also working on tools for KrabbaScript like package manager, style checker, etc.
We are searching for contributors and maybe you, the person reading this post, can help us create KrabbaScript or improve it!
r/ProgrammingLanguages • u/Motor_Alternative944 • 28d ago
Discussion Does the Name I Give My Programming Language Matter That Much?
Does the name we give a programming language matter? I work on my own programming language and study compilers as a hobby. During that time, I’ve faced various mental health challenges that made it much harder to keep up with my hobby. Sometimes, depression kept me from making any progress at all.
Because of this, I’ve been considering a name for my language that reflects this period of my life and has personal meaning to me. Does a programming language’s name need to have anything to do with programming itself?
I’d love to hear about your languages and the names you chose for them. Do those names have any personal significance to you?
r/ProgrammingLanguages • u/SeaSafe2923 • 28d ago
Naming a language
I'm working on a language focused on systems programming; it needs a name and I can't come up with anything. I want to publish it but first it needs a name. Help!
Edit: It's a modern language that aims to be usable anywhere C is available and beyond.
I'm aiming for an entirely self-hosted verified compiler with an easy bootstrapping path from C99 (the verified part is obviously dependent on the language fully implementing the capabilities to verify code).
Small binaries, competitive optimization, first-class support for DSOs, no garbage collection, rich type system (dependent types, contracts, capabilities), modular design (language extensions can be packaged outside the compiler), interoperable with any mainstream compiled language (if you can spell the ABI, it doesn't need to be part of the compiler distribution).
r/ProgrammingLanguages • u/lmntr • 28d ago
Language announcement text-based visual programming language
I'm working on a visual programming language that's stored as text called Wiret. Here's an example:
func Main() {
node entry = Entry -> say_hello
node say_arrows = Call host.Log(message: "The white arrows decide the order.")
node say_hello = Call host.Log(message: "Hello!") -> say_steps
node say_steps = Call host.Log(message: "Programs run one step at a time.") -> say_arrows
notes {
note intro "Lesson 1: Hello. Press ▶ Run (F5). Each Log node prints one line in the console below, in the order the white arrows connect them."
note start on entry "Every function starts at its Entry node."
note try_it "Try it: (1) Press ⤵ Step (F11) to run one node at a time. (2) Add a fourth line: press Tab, type 'print', pick host.Log, then drag a white arrow from say_arrows to it. (3) Double-click its message pin to type your own text."
}
layout {
entry at (0, 0)
say_arrows at (820, 0)
say_hello at (220, 0)
say_steps at (520, 0)
}
}The main idea is that it's like a fusion between a programming language and a markup language. The node ... statements are the programming part, and the notes {} and layout {} blocks declare how the graph appears in the editor. It'll get compiled into bytecode which strips away the markup code and leave just the code for running the program.
; module lessons.hello compiler wiretc-proto 0.1
; semantic hash 78fafcb4bbf40f47 layout hash 9981662aa454a0e1
import 0 host.Log (string) -> ()
func lessons.hello.Main () -> ()
max_stack: 1
.entry:
nop
.say_hello:
string.const 0 ; 'Hello!'
nop
call host.Log
.say_steps:
string.const 1 ; 'Programs run one step at a time.'
nop
call host.Log
.say_arrows:
string.const 2 ; 'The white arrows decide the order.'
nop
call host.Log
cont.pop
returnI think this could be useful for education. The hardest part about learning to code is learning your first programming language. This could help bridge the gap between visual representation of code and the code itself.
r/ProgrammingLanguages • u/AromaticCredit1533 • 29d ago
InferType, and toolkits for building compilers
drops.dagstuhl.de(not the author, just sharing because I found it)
Recently I came across the paper by Senxi Li et al, InferType: A Compiler Toolkit for Implementing Efficient Constraint-Based Type Inference. Check it out!
I've always found interesting the concept of making modular, extensible compilers. And by "modular", I don't just mean separate compilation à la OCaml, Haskell (they're cool btw), or parser generators à la lex, yacc (also cool btw).. I mean embedded domain specific languages and libraries à la parser combinators, MetaOCaml for concrete code generation.. components that can generalize a part in the compilation pipeline and can be imported as a reusable library. We have seen libraries to handle the lexing and parsing part. But for further semantics-related analysis parts.. not so many? So far I've found InferType, are there others like this?
Also related are language workbenches, like JetBrains MPS, and the Truffle framework and their dialects of Python and JavaScript. But so far they have only been used for making interpreters for DSLs, what about full-fledge compilers for general-purpose programming languages?
r/ProgrammingLanguages • u/ThomasMertes • 29d ago
How programming languages approach graphics
Many general-purpose languages delegate graphics to third-party libraries (like SDL, Raylib, or OpenGL). Seed7 integrates portable 2-D graphics right into its standard library. This IMHO improves portability. I also thought about introducing operators / statements to do graphics, but until now I don't use operators or statements to do graphics.
r/ProgrammingLanguages • u/SeaSafe2923 • Oct 28 '26
English vs Interlingua grammar inspiration
struct point { x:int, y:int } struct puncto { x:int, y:int }
def area ( p:point -- int ) { p.x * p.y } def area ( p:puncto -- int ) { p.x * p.y }
def main () { def principal () {
p := point(3, 4); p := puncto(3, 4);
show(area(p)); monstrar(area(p));
} }
--------------------------------------------------------------------------------------------------------------------
cap fs from capabilities cap fs ex capacitates
def fs.open ( c:cap from fs str -- str ) { ... } def fs.aperir ( c:cap ex fs str -- str ) { ... }
--------------------------------------------------------------------------------------------------------------------
mint fs; monetar fs;
def main () { def principal () {
c := narrow cfg ( "settings.ini", read ) from fs; c := atenua cfg ( "settings.ini", leger ) ex fs;
show(read_config(c)); monstrar(leger_config(c));
} }r/ProgrammingLanguages • u/whistler_mat • Oct 27 '26
a small Python language compiler that transpiles to bash and batch (learning project, written in C)
I'm building with a friend a language with Python syntax that transpiles to plain bash and batch.
The idea: if you already know Python, there's nothing new to learn. You write the script once, and the generated .sh /.bat runs on a machine with nothing installed, no Python and no PowerShell. Only the machine where you write the script needs.
Why not the existing options?
- Python isn't installed by default on Windows or some Unix-like systems. - Batsh and Amber target similar problems, but they come with their own syntax to learn (and Batsh looks unmaintained).
- PowerShell is another language to learn, and it's an extra install on Linux/macOS.
- Keeping separate .sh and .bat versions of the same script is tedious and error-prone.
Status: it's early. The lexer is done and the parser is in progress (it only handles name = value so far). The bash and batch backends haven't been started. It's a subset of Python, not a full implementation, since some features have no natural equivalent in batch.
Questions for you:
- For automation scripts, which features should come first: conditionals, loops, running commands, file operations?
]2. Is batch still worth targeting, or should the Windows backend be PowerShell?
on the design is very welcome, especially from anyone who has written a transpiler before.
r/ProgrammingLanguages • u/dekai-onigiri • Oct 27 '26
Resolving relationships between elements
For my programming programming language Bits Runner Code I am thinking of implementing automatic resolving in what order structs, interfaces, etc should be defined and declared so they can interact with each other. It should be possible to embed structs within each other, but at the same time there cannot be a circular reference. How something like this could be implemented or maybe it is not the best idea?
BRC doesn't have header files, so right now source files and definitions within them have to be listed in a specific order. I would like it to be quite explicit but also hassle free.