r/ProgrammingLanguages • • Jul 08 '20

I'm impressed with Raku

153 Upvotes

Sorry if this kind of post doesn't belong here.

A professor at my uni has recommended Raku (formerly Perl 6) to me as an interesting language with a bunch of cool design choices. I'm a programming language enthusiast and a hobby designer, so obviously, I got interested.

Perl has a bad rap of being unreadable, messy, and so on. So I was kinda expecting the same from Raku, but boy was I mistaken.

Now a disclaimer, I'm only a week or two into learning it and yes, there is some learning curve. But I'm very impressed. The language is clean, consistent, and most of all: extremely practical. There is a function for everything and the code you write is usually very concise, yet quite readable. Grammars are a true OP feature for a hobby language designer like me. The language is also very disciplined, for example, arguments to functions are immutable by default, including arrays and stuff.

It is kind of unfortunate that so few people use it, however, that could change considering the language was fully released only 4 years ago and renamed to Raku just 1 year ago.

But even if nobody used it, it would still probably be the most practical language for hobby language designers that I have encountered yet.

Thanks for reading, I just wanted to share.


r/ProgrammingLanguages • • Apr 28 '21

Have you heard about Seed7

152 Upvotes

Hello, I am Thomas Mertes. I have created a programming language based on my diploma and doctoral theses. I've been working on it since 1989 and released it after several rewrites in 2005 under the name Seed7. Since then, I improve it on a regular basis. Seed7 follows several design principles. The Homepage contains more information about Seed7.

Seed7 has an interpreter and a compiler, which compiles to machine code (via a C compiler as back-end). Beyond that, Seed7 provides run-time libraries which cover many areas. The run-time libraries are essential for the portability of Seed7 programs.

I consider libraries written in Seed7 a better approach than libraries that use an FFI to access external (binary) libraries. In the spirit of open source, you can look at the implementations of TLS, AES, LZW, LZMA, XZ, ZSTD, INFLATE, TAR, AR, CPIO, FTP, ZIP, RPM, BMP, PNG, GIF, JPEG and more. You might know what I mean if you ever searched for the source code of a corresponding C library and tried to understand it. Many people see libraries as a black box. I see black boxes as good concept, but I also like the opportunity to open a black box and see how it works. With Seed7 you can do that.

To demonstrate the possibilities of Seed7, I programmed the Unix utilities tar, ftp and make with it. I also implemented a ftp server, an http(s) server and a BASIC interpreter in Seed7. Various other Seed7 programs can be found here.

Please tell me what you think about Seed7 and its Homepage.

Support for Seed7 is always welcome.

Regards

Thomas Mertes


r/ProgrammingLanguages • • Jan 10 '21

Language announcement I wrote a new programming language that compiles to SQL

152 Upvotes

Hi everyone,

I’ve spent the last year working on a new interpreted, relational language, that I call Preql. It compiles to SQL at runtime (similar to how Julia does it). I'm hoping it can be to SQL the same thing that C was to Assembly: A high-level abstraction that makes work more efficient, and lets your code be more safe and expressive, without getting too much in your way.

I wrote it in Python, with heavy use of dataclasses and multiple-dispatch (which I implemented using function decorators), and Lark as the parser.

This is still a very young project, with a lot of missing features, but I believe it is already useful, and can be used to do real work.

I’m looking forward to hearing your thoughts, ideas, and even criticisms :)

Preql on Github: https://github.com/erezsh/Preql

Tutorial for the language: https://preql.readthedocs.io/en/latest/tutorial.html


r/ProgrammingLanguages • • Feb 12 '23

Discussion Are people too obsessed with manual memory management?

151 Upvotes

I've always been interested in language implementation and lately I've been reading about data locality, memory fragmentation, JIT optimizations and I'm convinced that, for most business and server applications, choosing a language with a "compact"/"copying" garbage collector and a JIT runtime (eg. C# + CLR, Java/Kotlin/Scala/Clojure + JVM, Erlang/Elixir + BEAM, JS/TS + V8) is the best choice when it comes to language/implementation combo.

If I got it right, when you have a program with a complex state flow and make many heap allocations throughout its execution, its memory tends to get fragmented and there are two problems with that:

First, it's bad for the execution speed, because the processor relies on data being close to each other for caching. So a fragmented heap leads to more cache misses and worse performance.

Second, in memory-restricted environments, it reduces the uptime the program can run for without needing a reboot. The reason for that is that fragmentation causes objects to occupy memory in such an uneven and unpredictable manner that it eventually reaches a point where it becomes difficult to find sufficient contiguous memory to allocate large objects. When that point is reached, most systems crash with some variation of the "Out-of-memory" error (even though there might be plenty of memory available, though not contiguous).

A “mark-sweep-compact”/“copying” garbage collector, such as those found in the languages/runtimes I cited previously, solves both of those problems by continuously analyzing the object tree of the program and compacting it when there's too much free space between the objects at the cost of consistent CPU and memory tradeoffs. This greatly reduces heap fragmentation, which, in turn, enables the program to run indefinitely and faster thanks to better caching.

Finally, there are many cases where JIT outperforms AOT compilation for certain targets. At first, I thought it hard to believe there could be anything as performant as static-linked native code for execution. But JIT compilers, after they've done their initial warm-up and profiling throughout the program execution, can do some crazy optimizations that are only possible with information collected at runtime.

Static native code running on bare metal has some tricks too when it comes to optimizations at runtime, like branch prediction at CPU level, but JIT code is on another level.

JIT interpreters can not only optimize code based on branch prediction, but they can entirely drop branches when they are unreachable! They can also reuse generic functions for many different types without having to keep different versions of them in memory. Finally, they can also inline functions at runtime without increasing the on-disk size of object files (which is good for network transfers too).

In conclusion, I think people put too much faith that they can write better memory management code than the ones that make the garbage collectors in current usage. And, for most apps with long execution times (like business and server), JIT can greatly outperform AOT.

It makes me confused to see manual memory + AOT languages like Rust getting so popular outside of embedded/IOT/systems programming, especially for desktop apps, where strong-typed + compact-GC + JIT languages clearly outshine.

What are your thoughts on that?

EDIT: This discussion might have been better titled “why are people so obsessed with unmanaged code?” since I'm making a point not only for copying garbage collectors but also for JIT compilers, but I think I got my point across...


r/ProgrammingLanguages • • Feb 14 '22

An Accessible Introduction to Type Theory and Implementing a Type Checker

Thumbnail
mukulrathi.com
151 Upvotes

r/ProgrammingLanguages • • Feb 03 '21

Introducing Neb: A parser with the nebulous purpose of reading mathematical syntax (https://github.com/JohnDTill/Neb)

Post image
151 Upvotes

r/ProgrammingLanguages • • Jan 06 '21

Discussion Lessons learned over the years.

151 Upvotes

I've been working on a language with a buddy of mine for several years now, and I want to share some of the things I've learned that I think are important:

First, parsing theory is nowhere near as important as you think it is. It's a super cool subject, and learning about it is exciting, so I absolutely understand why it's so easy to become obsessed with the details of parsing, but after working on this project for so long I realized that it's not what makes designing a language interesting or hard, nor is it what makes a language useful. It's just a thing that you do because you need the input source in a form that's easy to analyze and manipulate. Don't navel gaze about parsing too much.

Second, hand written parsers are better than generated parsers. You'll have direct control over how your parser and your AST work, which means you can mostly avoid doing CST->AST conversions. If you need to do extra analysis during parsing, for example, to provide better error reporting, it's simpler to modify code that you wrote and that you understand than it is to deal with the inhumane output of a parser generator. Unless you're doing something bizarre you probably won't need more than recursive descent with some cycle detection to prevent left recursion.

Third, bad syntax is OK in the beginning. Don't bikeshed on syntax before you've even used your language in a practical setting. Of course you'll want to put enough thought into your syntax that you can write a parser that can capture all of the language features you want to implement, but past that point it's not a big deal. You can't understand a problem until you've solved it at least once, so there's every chance that you'll need to modify your syntax repeatedly as you work on your language anyway. After you've built your language, and you understand how it works, you can go back and revise your syntax to something better. For example, we decided we didn't like dealing with explicit template parameters being ambiguous with the < and > operators, so we switched to curly braces instead.

Fourth, don't do more work to make your language less capable. Pay attention to how your compiler works, and look for cases where you can get something interesting for free. As a trivial example, 2r0000_001a is a valid binary literal in our language that's equal to 12. This is because we convert strings to values by multiplying each digit by a power of the radix, and preventing this behavior is harder than supporting it. We've stumbled across lots of things like this over the lifetime of our project, and because we're not strictly bound to a standard we can do whatever we want. Sometimes we find that being lenient in this way causes problems, so we go back to limit some behavior of the language, but we never start from that perspective.

Fifth, programming language design is an incredibly under explored field. It's easy to just follow the pack, but if you do that you will only build a toy language because the pack leaders already exist. Look at everything that annoys you about the languages you use, and imagine what you would like to be able to do instead. Perhaps you've even found something about your own language that annoys you. How can you accomplish what you want to be able to do? Related to the last point, is there any simple restriction in your language that you can relax to solve your problem? This is the crux of design, and the more you invest into it, the more you'll get out of your language. An example from our language is that we wanted users to be able to define their own operators with any combination of symbols they liked, but this means parsing expressions is much more difficult because you can't just look up each symbol's precedence. Additionally, if you allow users to define their own precedence levels, and different overloads of an operator have different precedence, then there can be multiple correct parses of an expression, and a user wouldn't be able to reliably guess how an expression parses. Our solution was to use a nearly flat precedence scheme so expressions read like Polish Notation, but with infix operators. To handle assignment operators nicely we decided that any operator that ended in = that wasn't >=, <=, ==, or != would have lower precedence than everything else. It sounds odd, but it works really well in practice.

tl;dr: relax and have fun with your language, and for best results implement things yourself when you can


r/ProgrammingLanguages • • Jul 12 '20

Language announcement Vale

151 Upvotes

After eight years, Vale just hit its first major milestone: we ran our first real program! It's a basic terminal roguelike game (you can walk around and bump into enemies to defeat them) but under the hood it's using the full spectrum of language features: interfaces, generics, polymorphic lambdas, ownership, destructors, universal function call syntax, infix calling, tuples, arrays, underscore params, externs, destructuring, and even const generics. With this program and our other tests, we can finally say that Vale's approach works!

We'll be introducing Vale to the world over the next few weeks, but I wanted to start the conversation here. We couldn't have gotten this far without all the brilliant folks here in r/programminglanguages and in the discord, and we want to hear your thoughts, questions, criticisms, and ideas on where we should go next!

More can be found on https://vale.dev/, but here's a reddit-post-sized explanation of what Vale is and where it's going:

Vale's main goal is to be as fast as C++, but much easier and safer, without sacrificing aliasing freedom. It does this by using "constraint references", which behave differently depending on the compilation mode:

  • Normal Mode, for development and testing, will halt the program when we try to free an object that any constraint ref is pointing at.

  • Fast Mode compiles constraint refs to raw pointers for performance on par with C++. This will be very useful for games (where performance is top priority) or sandboxed targets such as WASM.

  • Resilient Mode (in v0.2) will compile constraint refs to weak refs, and only halt when we dereference a dangling pointer (like a faster ASan). This will be useful for programs that want zero unsafety.

Vale v0.2 will almost completely eliminate Normal Mode and Resilient Mode's overhead with:

  • Compile-time "region" borrow checking, where one place can borrow a region as mutable, or multiple places can borrow it as immutable for zero-cost safe references. It's like Rust but region-based, or Verona but with immutable borrowing.

  • Pure functions, where a function opens a new region for itself and immutably borrows the region outside, making all references into outside memory zero-cost.

  • "Bump calling", where a pure function's region uses a bump allocator instead of malloc/free.

Between these approaches, we get performance and memory safety and mutable aliasing. We suspect that in practice, Vale programs could incur even less overhead than Rust's usual workarounds (Rc, or Vec + generational indices), and with easy bump calling, could even outperform C++ in certain circumstances.

We hope that Vale will show the world that speed and safety can be easy.

Vale explicitly does not support shared mutable ownership (C++'s shared_ptr, Rust's Rc, Swift's strong references), though it does allow shared ownership of immutable objects. One would think that a language needs shared mutables, but we've found that single ownership and constraint references largely obviate the need. In fact, taking out shared ownership opened a lot of doors for us.

In a few days we'll post to various sites (here, r/cpp, r/programming, HN, etc.) about how our approach enabled us to take RAII further than ever before, with multiple destructors, destructor params and return values, and un-droppable owning references. After that, we might post about constraint refs' potential for cross-compilation, or how RC + regions could drastically outperform garbage collection. We're interested in your thoughts, reply below or swing by our discord!

PS. Fun fact, eight years ago Vale was originally called vlang, but http://vlang.org (since taken down) and more recently http://vlang.io already have that name, so we called it GelLLVM (in honor of Gel which first introduced constraint refs in 2007) and recently settled on the name Vale.


r/ProgrammingLanguages • • May 12 '26

Language announcement revo, the programming language that likes you

Thumbnail gills.pages.dev
150 Upvotes

a dynamic language for the joy of programming

very pleasant to write code in. you may like this this if you like lua and elixir/ruby

made in zig, but has a c extension&embedding system started

edit: relicensed under MIT


r/ProgrammingLanguages • • Nov 17 '25

What if everything was "Async", but nothing needed "Await"? -- Automatic Concurrency in Par

Thumbnail
youtu.be
150 Upvotes

I made a new video, showcasing and explaining the "automatic concurrency" in the Par programming language!

I think this is the first time I actually manage to convey this unusual, but absolutely foundational feature of my language.

In the video, I walk through a "concurrent downloader" application, visualize how it's put together, and explain how Par's concurrent evaluation makes it all work.

I'm very curious to hear what you think!

And if you don't know, Par is an innovative (and WIP) programming language with linear types, duality, automatic concurrency, and more.


r/ProgrammingLanguages • • Aug 14 '25

Blog post Why Lean 4 replaced OCaml as my Primary Language

Thumbnail kirancodes.me
148 Upvotes

r/ProgrammingLanguages • • Aug 11 '25

Tur - A language for defining and executing Turing machines with multi-platform visualization tools (Web, TUI and CLI)

148 Upvotes

Hi, here's my first little language for playing around with Turing Machine. It supports both single and multi-tape with minimal and readable syntax. Feel free to share any feedback!

https://github.com/rezigned/tur


r/ProgrammingLanguages • • Apr 17 '24

Discussion Finally implemented an LSP server for my language after about a year of working on it on-and-off, wanted to share it here!

148 Upvotes

r/ProgrammingLanguages • • May 14 '21

Resource Counterexamples in Type Systems

Thumbnail counterexamples.org
148 Upvotes

r/ProgrammingLanguages • • Nov 18 '25

Language announcement I created a programming language with only one instruction: NAND1

147 Upvotes

https://github.com/craftyBLUE/Nand1

A programming language with only one instruction, the only thing you have to specify is the memory address being manipulated. The contents of a Nand1 source code file are just numbers separated by spaces.

In Nand1 you work with bits: 0 or 1. You have 2^32 bits of memory available.

Take for example the instruction X (any nonnegative number less than 2^32), the language will do the following steps in order:

  1. compare bits in memory at position 0 and at position X with the NAND operator ( not (A and B) )

  2. set the bit at location X to be the same as the bit at position 0

  3. set the bit at location 0 to the result from step 1.

Memory I/O features:

  • halt - exits program if a bit is set

  • input - inputs one ASCII char per request

  • output - outputs one ASCII char per request

Hello world example: prints "Hello World!" and exits

1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 0 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 0 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 0 20 1 0 1 1 21 1 0 1 1 0 22 1 0 1 1 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 21 1 0 1 1 22 1 0 1 1 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 0 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 0 20 1 0 1 1 0 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 0 18 1 0 1 1 19 1 0 1 1 0 20 1 0 1 1 21 1 0 1 1 22 1 0 1 1 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 21 1 0 1 1 22 1 0 1 1 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 19 1 0 1 1 0 20 1 0 1 1 0 21 1 0 1 1 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 20 1 0 1 1 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 0 20 1 0 1 1 21 1 0 1 1 0 22 1 0 1 1 0 23 1 0 1 1 3
1 0 1 1 0 16 1 0 1 1 0 17 1 0 1 1 18 1 0 1 1 0 19 1 0 1 1 0 20 1 0 1 1 0 21 1 0 1 1 0 22 1 0 1 1 23 1 0 1 1 3

1 0 1 1 2

The repeating sequence "1 0 1 1" just helps to always set value 1 to location 0 before writing a bit to the output. Similarly, "1 0 1 1 0" always sets value 0 to location 0 because "0" flips the bit at location 0.

Source code available on GitHub: https://github.com/craftyBLUE/Nand1


r/ProgrammingLanguages • • Apr 01 '25

Bold move by European Commission towards the memory safe language Seed7

147 Upvotes

The European Commission issued a strategy paper about memory safety. They propose a European concept of memory safety. They introduce categories of memory safety and the categories are summarized in the memory-safety levels 1 to 5. Language features are categorized regarding their support of memory safety.

They introduced the terms wild-pointer (which is essentially a C pointer) and checked-pointer. Inside the category of checked-pointers they further distinguish between ones which can be NULL and ones that cannot be NULL. So Java references count as checked-pointers which can be NULL. Interesting fact: Although C++ references cannot be NULL they count as wild-pointers, because there are ways to cast a C++ pointer to a reference.

Regarding unsafe-parts and inline-assembly they state that they are overused which compromises safety. They made a study about languages with unsafe-parts and inline-assembly. The study found out: About 30% of all Rust crates incorporate some use of unsafe Rust. The study also states: 70% of Rust developers are calling unsafe code through foreign functions.

In their language evaluation the language Seed7 is the clear winner. It is the clear winner because it is memory safe and has no unsafe parts. As a consequence the European Commission proposes the use of Seed7 in many areas of software development. There will be a Europe-wide research fund to facilitate the use of Seed7 in more areas. Companies will have tax reductions if they rewrite programs or libraries in Seed7.

This is seen as long term commitment of the European Union to improve software quality and to make Europe independent in the software industry.


r/ProgrammingLanguages • • Mar 17 '22

Blog post C Isn't A Programming Language Anymore - Faultlore

Thumbnail
gankra.github.io
147 Upvotes

r/ProgrammingLanguages • • May 06 '25

Why don't more languages include "until" and "unless"?

146 Upvotes

Some languages (like Bash, Perl, Ruby, Haskell, Eiffel, CoffeeScript, and VBScript) allow you to write until condition and (except Bash and I think VBScript) also unless condition.

I've sometimes found these more natural than while not condition or if not condition. In my own code, maybe 10% of the time, until or unless have felt like a better match for what I'm trying to express.

I'm curious why these constructs aren't more common. Is it a matter of language philosophy, parser complexity, or something else? Not saying they're essential, just that they can improve readability in the right situations.


r/ProgrammingLanguages • • Jan 06 '23

Microfeatures I'd like to see in more languages

Thumbnail
buttondown.email
146 Upvotes

r/ProgrammingLanguages • • Apr 12 '21

What are some cool/wierd features of a programming language you know?

146 Upvotes

I'm asking this question out of curiosity and will to widen my horizons.


r/ProgrammingLanguages • • Mar 01 '20

What's your favorite programming language? Why?

146 Upvotes

What's your favorite programming language? Why?


r/ProgrammingLanguages • • Sep 21 '26

Discussion Afraid my language doesn't mean anything anymore

143 Upvotes

First of all, I am sorry if this is not strictly a techincal post, but I would apreciate if it would be allowed. So a couple of years ago, like a year or two before the chatgpt, I made my own interpreted programming language. It could be used for basic scripts and had basic functionalities like nested ifs and while, string, int and double types, variable scopes and even functions and recursion. It can parse math with + - + ÷ and brackets. It is nothing special, syntax resambeles more or less C# but with keyword in my natural language. It was made entirely by hand, from lexical analysis, parser, semantic analyser and the interpreter itself. I also made ebnf for it.

I think we on this sub can all agree that there are a few of us programmers, developers or cs-s who willingly put themselves through this. It can be painstakingly hard to implement a new language. I am very proud of it and to this day it is my biggest achivement. No other thing in my proffesional or personal projects required such level of detail, knowledge and research.

And all this before the AI. But here is where it gets frustrating. Back than this was my "selling point". This was something that I could show my knowledge, dedication and attention to detail with. It made me feel safe for my professional future. Now I am afraid that it doesn't mean enything anymore. Like nobody gives a s*** about it anymore.


r/ProgrammingLanguages • • Jun 10 '23

My bachelors project. A compiler, assembler and a CPU that the code finally runs on.

143 Upvotes

https://github.com/CoolBassist/Final-year-project

In this project I designed and simulated a CPU which is based on the SAP-1, with a custom ISA. A compiler which takes my high level language called JWhile, which has features such as branches, for/while loops, arrays. And an assembler which takes the assembly and turns it into machine code for the CPU.

I have also added a CPU emulator, so you dont need to download the software that I used to create the "real" CPU.

Any feedback/comments would be greatly appreciated :)


r/ProgrammingLanguages • • Aug 21 '21

Parser generators vs. handwritten parsers: surveying major language implementations in 2021

Thumbnail notes.eatonphil.com
143 Upvotes