r/ProgrammingLanguages • • Feb 28 '26

I built a scripting language that works like notebooks - but without Jupyter

16 Upvotes

I built a scripting language that lets you write normal code but generate notebook-style outputs (Markdown/HTML/etc.) directly from it — without using something like Jupyter.

I'm curious if this is something you'd actually use or if I'm overengineering this.

Also this post was generated by moss, so here's some code being run.

fun test(a) {
    return a + 1
}

f"Result: {test(1)}"

[Output]:

Result: 2

How "notebook"/file generation works

You can place "notes" inside of your program that look similar to comments:

md"This is a _Markdown_ note in Moss."

When you run moss, you choose the output format and file and the note will be written into that file (or stdout) in the selected format. But it doesn't have to be the format you wrote it in, you can select the output to be html and this markdown will be converted into HTML using internal converters and generators or you can provide your own (which allows for custom formats as well).

moss -f html -O index.html hello.ms

HTML output comes with a default CSS style, but you can easily override it:

Generators.HTML.STYLE_PATH = "my_style.css"

But one of the main features of "notebooks" is that you can see the code and the output it creates, which is also possible in moss. All you have to do is specify an annotation @!enable_code_output and you will get a code snippets and output it produced. Here is a more advanced example with a custom converter, which makes the output -^fancy^-:

fun txt2md(txt) {
    @!converter("txt", "md")
    return Note("-*^"++txt++"^*-", "md")
}

fun compute_meaning() = Math.sum([i : i = 0..6]) + 27

fun hello(who:String) {
    return f"Hello, {who}. The answer is {compute_meaning()}."
}

hello("Reddit")

[Output]:

-*^Hello, Reddit. The answer is 42.^*-

The reason I have decided to go this way is that I enjoy having code in notebooks and quite often I want to generate some output (e.g. report from testing or benchmarking script), but I don't like programming in notebooks and prefer my usual coding editors, not having to code in a browser and also seeing the notes right in the code, which moss allows. At the same time if you wish to get just the result of some computation without any notes you can simply do so with -q option.

Key features

Some of the key features:

  • Interpreted but from a compiled bytecode (shareable without source code).
  • Inspired by Python, with built-in Python and C interop.
  • C-style syntax.
  • Dynamically typed.
  • Optional type annotations and function overloading.
  • Why not just use Jupyter?

    • no browser
    • no notebook JSON format
    • version control friendly
    • regular editor workflow.

This might be useful if you:

  • write scripts that generate reports
  • are doing data science or teaching and want to show more info but also get just the result at times
  • want notebook-style output without using Jupyter
  • like Python but prefer C++ style syntax and approach (with overloading, spaces, enums...)

Current status

Moss is not yet production ready, but I have been already using it to run tests and benchmarks and for some hobby projects.

There is a public repo for it: https://github.com/mark-sed/moss-lang, with some more examples and build instructions. I am trying to make it user friendly and easy to use.

The standard library is getting bigger by day and having Python interop allows to use any Python libraries when needed. When it comes to formats (converters and generators), there is now support for Markdown, CSV and HTML as an output format, way more are to come soon.

Questions

What would make this actually useful to you? I would love to get more insight and ideas from the outside. Thank you.


r/ProgrammingLanguages • • Feb 27 '26

Resource 1 Problem, 7 Array Languages

Thumbnail youtube.com
34 Upvotes

r/ProgrammingLanguages • • Feb 27 '26

Brave new C#

Thumbnail pvs-studio.com
18 Upvotes

r/ProgrammingLanguages • • Feb 27 '26

Requesting criticism Are functions just syntactic sugar for inheritance?

Thumbnail arxiv.org
37 Upvotes

r/ProgrammingLanguages • • Feb 27 '26

Discussion Should for loops dispose of their iterators?

13 Upvotes

Many languages desugar for x in iterable: print(x) to something like:

it = iterable.iterator()
while it.has_next():
    print(it.current())

Should this desugaring be followed by it.dispose()? Different languages take different approaches:

  • If the for loop does not dispose of the iterator (e.g. Python):

    • This may cause problems if iterator returns a new object each time (e.g. if iterable is a list): * The iterator will not be properly disposed until it is garbage-collected (there's no way for the author of the loop to access the iterator) [issue 1]
    • But if iterator returns the same object each time (e.g. if iterable is a file): * One iteration can continue from a previous one, allowing code like this to work correctly:

              f = File.open(...)
              for line in f:
                  if line == '---': break
                  process_header(line)
              ...
              for line in f:
                  process_body(line)
  • If the for loop does dispose of the iterator (e.g. C#):

    • This works well if iterator returns a new object each time: * The for loop creates and owns the iterator, so it makes sense for it to also dispose of it
    • But if iterator returns the same object each time: * The iterator can only be used in a single for loop and will then have dispose called, preventing code like the above from working as expected [issue 2]

There are ways around issue 2, that would allow multiple for loops to work even in the presence of dispose. For example, there could be a a way to keep an iterator alive, or the programmer could simply be required to write out the desugared loops manually. However I'm not aware of a solution to issue 1, so perhaps the correct approach is for loops to dispose of iterators.

On the other hand, it seems inelegant to conflate iteration and lifetime management in this way. For example, it seems strange that passing a file handle to a for loop would close the file.

Which approach do you think is the right one? Should for loops dispose of the iterators they are using, or not? Or put another way: should for loops own the iterators they consume, or just borrow them?


r/ProgrammingLanguages • • Feb 27 '26

Language announcement I Made a Threads Library for my C-Like Programming Language

Thumbnail github.com
3 Upvotes

I just wanted to share this as this is one of the more syntactically complicated projects I have made and I can finally see my language being able to be used in big projects. I have been making this language since the beginning of the year using C.

This library is using a pre-release version (see the notes on the release), but you can see documentation for the current release at quar.k.vu.

I can't wait to release this version as a full release so I can start really building projects in my language!


r/ProgrammingLanguages • • Feb 27 '26

Syntax highlighting for string interpolation

8 Upvotes

Im trying to create a language with string interpolation like "score: \(calc_score())". String interpolation can contain arbitrary expressions, even other strings. To implement this my lexer does some parenthesis counting. Im thinking about how this would work with syntax highlighting, specifically for VS code. From what i understand languages in VS code typically use a textMate grammar for basic highlighting and than optionally have the language server provide some semantic tokens. How do languages deal with this normally because from what i understand a textMate grammar cannot handle such strings? You cant just have it tokenize an entire string including interpolation because if it contains nested strings it does not know which '"' ends the string. Thanks!


r/ProgrammingLanguages • • Feb 26 '26

Against Query Based Compilers

Thumbnail matklad.github.io
105 Upvotes

r/ProgrammingLanguages • • Feb 26 '26

Discussion Whats the conceptual difference between exceptions and result types

19 Upvotes

So to preface what looks probably to many of you like a very dumb question. I have most experience in Python and Julia both languages which are not realy great at error handling. And as such I have not much experience either.

I am currently trying to create my dream programming language, I am still in the draft phase, which will likely take a long while because I only draft on it once in a while. But I have been realizing that I do not understand the difference between exceptions and result types.

What I mean is I do obviously understand that they are different things but when talking about Error handling I do not understand why they are often two different things. I hope someone can help me clarify what the main conceptual difference between these two is.

Kind regards and I hope yall have a lovely day.


r/ProgrammingLanguages • • Feb 26 '26

Discussion Looking for challenging projects/tests for a new programming language (imports + WASM work)

10 Upvotes

I’ve been working on a small experimental programming language that now supports modules/imports and can target WebAssembly. I’d like to push it further with “real” but still manageable problems, beyond toy arithmetic and tiny scripts.

When you build or experiment with a new language, what kinds of projects or benchmarks do you use to really stress it? I’ve seen people suggest things like databases or fractals; others mention interpreters, games, etc.

If you were trying to uncover design flaws, missing features, or performance issues in a young language, what concrete projects or problem sets would you pick first?

Thanks for any ideas or pointers!


r/ProgrammingLanguages • • Feb 26 '26

Evolving Languages Faster with Type Tailoring

Thumbnail lambdaland.org
12 Upvotes

r/ProgrammingLanguages • • Feb 26 '26

Language announcement C3 0.7.10 - Constdef finally takes shape

Thumbnail c3-lang.org
10 Upvotes

Sometimes names and syntax work out and sometimes they don't. With 0.7.10 a long journey of iterations to representing C enums with gaps in C3 comes to its conclusion.


r/ProgrammingLanguages • • Feb 26 '26

Requesting criticism Trouble choosing syntax for my language.

2 Upvotes

I want a terse language that will be easy to type and also teach me machine code. However, I don't know how to make machine code terse enough that it is efficient while still requiring manually filling out every field.

This is all I've come up with so far, and all symbols are basically ignored since they all turn back into regularly formatted machine code with 'dd opcode, modrm, sib, const`. But I also want it to be irritating and cause errors when the syntax isn't correct, even if it is ignored.


  mov         al, cl
  mov         BYTE PTR[rsp], al
  mov         ax, cx
  mov         BYTE PTR[rsp], cx



  88h,  11 001[000]
  88h,  01 000[100], [00 100 100], 20h
  89h,  11 001[000]
  89h,  01 000[100], [00 100 100], 20h

Above is the assembly and the bottom is the proposed syntax. Any tips? I can't use the shift key and I'd like it to stay terse, but maybe a little more expressive. I can't use the shift key because it requires an extra key stroke, which is inefficient.

It is necessary for the language to be machine code, so only looking for criticism about the syntax.

Thank you.

Edit: reddit destroyed my formatting, so sorry.

Edit1: I'm getting down voted and I'm not sure why. It's not a shitpost and I genuinely am looking for syntax ideas.


r/ProgrammingLanguages • • Feb 26 '26

[Showcase] An effort to implement a safe context for C++

4 Upvotes

Hello everyone, I’ve been working on a runtime library called SafeCpp, which specifically focuses on ensuring that heap allocations achieve the same level of compile-time safety as Rust, but managed purely through language runtime mechanics rather than compile-time static borrow checking or ownership checking. I want to emphasize that this research strictly focuses on a custom safe context to prevent 4 types of memory errors: Double Deletion, Access Violation, Buffer Overflow and Memory Leaks.

Core Architectural Concepts Under Investigation:

  1. Strict Heap Boundary Enforcement: Tracking the initialization and destruction boundaries of objects explicitly allocated on the heap, ensuring references cannot outlive their allocation scope.
  2. Explicit Lifetime Invalidation: The runtime library tracks every heap-allocated instance of types that inherit from Safe::SafeContextBase and offers recycling/repurpose mechanisms to gain performance instead of relying on deallocations which require accessing the operating system kernels to perform system calls. This approach completely removes the need for reference counting like in `std::shared_ptr`.
  3. No External Tooling Dependencies: The runtime mechanics are implemented strictly using platform capabilities and the standard C++ language.

Seeking Feedback on the Implementation

I have opened up the complete source and headers of this implementation under a dual-licensing model (including the GPLv3 License) so that other system engineers and language researchers can audit the exact low-level mechanics.

👉 GitHub Repository: https://www.github.com/quantumboy-ducna/SafeCpp


r/ProgrammingLanguages • • Feb 25 '26

Blog post Blog: Empty Container Inference Strategies for Python

19 Upvotes

Empty containers like [] and {} are everywhere in Python. It's super common to see functions start by creating an empty container, filling it up, and then returning the result.

Take this, for example:

def my_func(ys: dict[str, int]):
  x = {}
  for k, v in ys.items():
    if some_condition(k):
      x.setdefault("group0", []).append((k, v))
    else:
      x.setdefault("group1", []).append((k, v))
  return x

This seemingly innocent coding pattern poses an interesting challenge for Python type checkers. Normally, when a type checker sees x = y without a type hint, it can just look at y to figure out x's type. The problem is, when y is an empty container (like x = {} above), the checker knows it's a dict, but has no clue what's going inside.

The big question is: How is the type checker supposed to analyze the rest of the function without knowing x's type?

Different type checkers implement distinct strategies to answer this question. This blog will examine these different approaches, weighing their pros and cons, and which type checkers implement each approach.

Full blog: https://pyrefly.org/blog/container-inference-comparison/


r/ProgrammingLanguages • • Feb 25 '26

PL/I Subset G: Parsing

7 Upvotes

I'm working on a compiler and runtime library for PL/I Subset G (henceforth just G). I intend to support the ANSI X3.74-1987 standard with a bare minimum of extensions. Compatibility with other PL/I compilers is not intended. The compiler will be open source; the library will be under the MIT license and will include existing components such as decNumber and LMDB needed by G.

I have not yet decided on the implementation language for the compiler, but it will not be G itself, C, C++, or assembler. The compiler will generate one of the GNU dialects of C, so that it can take advantage of such GNU C extensions as nested functions, computed gotos, and other G features. In this way the compiler will be close to a transpiler.

The first thing I would like advice on is parsing. G is a statement oriented language. Each statement type except assignment begins with a keyword, like Basic, but G is free-format, not line-oriented. Semicolon is the statement terminator.

However, there are no reserved words in G: context decides whether an alphanumeric word is a keyword or an identifier. For example, if if = then then then = else else else = if; is a valid statement. Note also that = is both assignment and equality: goto foo; is a GOTO statement, but goto = foo; is an assignment statement. There are no assignment expressions, so there is no ambiguity; a few built-in functions can appear on the left side of assignment, as in substr(s, 1, 1) = 's';.

I'm familiar with LALR(1) and PEG parser generators as well as hand-written recursive descent parsers, but it's not clear to me which of these approaches is most appropriate for parsing without reserved words. I'd like some advice.


r/ProgrammingLanguages • • Feb 24 '26

Package Managers à la Carte: A Formal Model of Dependency Resolution

Thumbnail arxiv.org
32 Upvotes

r/ProgrammingLanguages • • Feb 24 '26

UNSOUND at Ecoop

10 Upvotes

Dear ProgrammingLanguages community,
We are organizing a relevant workshop on Ecoop this year, It would be great if some of you may want to contribute.
Here all the details:

Title: UNSOUND Workshop at ECOOP 2026

UNSOUND 2026 - Sources of Unsoundness in Type Systems and Verification

Workshop co-located with ECOOP 2026, Brussels, Belgium

https://2026.ecoop.org/home/unsound-2026

The 3rd UNSOUND workshop covers all aspects of unsoundness in type system and verification tools and theories. It is meant to entertain a community-wide discussion on possible sources of unsoundness and how to avert, address, and tackle them. We are particularly interested in the presentation of previously unknown or lesser known problems as well as discussions of well-known soundness holes and how they affect the day-to-day of programming language researchers and users.

Important Dates:

--------------------------

2026-03-31: Submission Deadline

2026-04-14: Author Notification

2026-06-30: Workshop Date

Goals

-----------

The goals of the workshop are:

- To discover sources of unsoundness in different type systems and verification tools

- To share experiences and exploits on how different tools can either be broken or expose confusing behaviour

- To broaden the attention of researchers to topics which so far escaped their focused area of research; e.g., from only type correctness to also avoiding stack overflows

- To challenge assumptions uncritically assumed as valid reasoning principles in the field

- To connect researchers from different areas of type systems and verification

- To engage with and encourage the next generation of researchers in verification

Examples for possible contributions would be:

- Defining soundness and how it can diverge between languages and tools.

- Exploring the divergences between user assumptions and actual definitions of soundness.

- Summarising common sources of unsoundness and why they emerge.

- Reporting logic errors in the specification of a verification tool, e.g., universe inconsistencies.

- Finding bugs in the implementation of type & proof checkers.

- Discovering overconfident generalisations of sound subsystems to larger settings, e.g., imperative techniques in OO settings.

- Formally characterising escape hatches, which most practical systems possess, and finding how to use them without compromising the soundness of the parts of a program that don’t use them.

- Reporting on unexpected soundness holes in type systems for dynamic languages, which can lead to more surprises at runtime.

- Disproving soundness statements in published papers.

- Finding statements proven in published literature that should no longer be trusted because they relied on a broken system.

- Simply proving False in a verification tool or exhibiting non-termination in a total language; in particular, we are interested in practical ways to trick available tools to accept wrong input.

- Breaking reasoning about programs with types by breaking the type system of the programming language in new and interesting ways.

- Bad interactions between axiomatic choices in libraries used in proofs.

- Impacts of the false sense of security when the chain of trust is broken by subtle unsoundness in verification tools.

Call for Presentations

--------------------------------

The submission should consist in a two-page extended abstract. Additional material (bibliography, related work, and code examples) will not count toward this limit. We strongly encourage authors to include instructions to reproduce results or exploits.

There will be a friendly and open-minded peer review process, focusing on checking that the submitted material is appropriate for presentation at the workshop and likely to spur interesting conversations.

Accepted extended abstract will be made publicly available on the workshop webpage. However, presentation at UNSOUND does not count as prior publication, will not appear in formal proceedings, and can later be published at a conference of the authors’ choosing.

Instruction to Authors and Submission guidelines

---------------------------------------------------------------------

Submissions should be made via Easychair 

https://easychair.org/conferences?conf=unsound2026 

by 2026-03-31 (AoE).

Submitted abstracts should be in portable document format (PDF), formatted using the ACM SIGPLAN style guidelines. Authors should use the acmart format, with the acmsmall sub-format for ACM proceedings. For details, see: 

http://www.sigplan.org/Resources/Author/#acmart-format

It is recommended to use the review option when submitting an abstract; this option enables line numbers for easy reference in reviews.

Who is involved?

--------------------------

Unsound is currently managed by Jan Bessai, Colin Stebbins Gordon, Vasileios Koutavas, Marco Servetto, and Lionel Parreaux. 

You can chat with us at unsound2026@easychair.org


r/ProgrammingLanguages • • Feb 24 '26

Discussion Memory Management

44 Upvotes

I wanted to write "my" programming language more than 20 year ago, but then always deferred it. I finally started about a year ago. I wanted the language to be very concise, fast, and reasonably simple to use, and secure. So far, I'm quite happy in what I have achieved.

One of the distinguishing features of my language, Bau, is that it doesn't do "hidden" things, like tracing garbage collection (I'm a long-term Java user). The language should use little memory, not use background threads to clean up, not use JIT. And so be usable for games (where you can't afford dropped frames), operating systems, command line tools that need fast startup, etc.

But so far there was no good way to visualize garbage collection stop-the-world pauses; I think I now found a way, at least for the stop-the-world pauses, via a benchmark. (I didn't invent the benchmark btw.) I can now show that languages that use tracing GC do have multi-millisecond pauses, and languages that don't have much shorter pauses: 0.05 instead of 10 and more milliseconds.

I also found that in C, the default malloc and free also has (short) pauses sometimes, and only specialized malloc / free implementations are able to further reduce the pauses. So I did implement such a malloc / free variant, based on the algorithm of TLSF, a memory allocator for real-time systems. Interestingly, my malloc implementation doesn't just have shorter pauses, but is also faster than the default one.

One thing I found is that when freeing a deeply nested structure, both reference counting GC (my language) as well as ownership (Rust) can cause stack overflow. I have solved this for my language now by converting recursive deallocation into a loop (no, this is not tail recursion elimination); in Rust, as a developer, you are on your own.

I understand the community here is more interested in high level / functional languages, and not so much in embedded systems / close-to-hardware things, but I still wanted to share these results. Let me know if you have some comments or questions!


r/ProgrammingLanguages • • Feb 25 '26

Language announcement ylang Progress (v0.2.0)

2 Upvotes

Hi, everyone. I shared ylang v0.1.0 3 months ago.
Now, I'd like to introduce ylang v0.2.0.

I want to put effort into developing ylang, but I’m also developing some projects at my company, so progress is very slow.

Thanks for reading — feedback or questions are very welcome.

Check out ylang here


r/ProgrammingLanguages • • Feb 24 '26

Discussion How Complex is Your Programming Language

Thumbnail emulationonline.com
13 Upvotes

r/ProgrammingLanguages • • Feb 23 '26

Requesting criticism Bern: An Interpreted Dynamically Typed Programming Language

29 Upvotes

Hello everyone!
I am currently working on an Odin/Haskell/Lua inspired interpreted programming language built entirely in Haskell. Bern was originally just supposed to be an APL inspired Set Theory programming language (as i'm currently studying formal systems) but I kinda got a bit excited and tried to make a language out of it!

You can check Bern out here.
Or, download/read the docs here: https://bern-lang.github.io/Bern/

I have no prior experiences writing compilers or interpreters (except my paper and previous project - Markers - an Academic-focused document generator and markup language, which I used as a basis for the codebase of Bern together with some OCaml tutorials I found), so everything is kinda of a first for me. I tried doing something different and came to realize that - for a beginner - every statement should be evaluated immediatly, so that's where I kinda started building it.

Bern now has a functioning interpreter, repl, library support and foreign function interfaces (although I really suffered on how to make this properly, so it may have some issues). There is also support for one-liner functions, lambdas, pattern matching, algebraic data types and hashmaps.

Bern is not a functional programming language, it's more like a Python/Lua scripting language that can be used for a variety of things, but now I feel it's kinda mature enogh for me to share it!

I'm free to answer any questions regarding the language, and ways to improve it further on the future.


r/ProgrammingLanguages • • Feb 23 '26

Error handling for functions with side effects

13 Upvotes

I've been thinking a lot about error handling since im designing my own language.

I quite like the errors as values approach where a function returns the succesful value or some error value. I find this very intuitive and it seems like a big improvement over exceptions

However, sometimes the point of a function is mainly to produce a side effect like writing to a file or setting an element of a data structure. You do not really care about the result here which i think clashes a bit with the errors as value approach. As far as i know some languages would represent by having the return be a possible error. In a language like go this can simply be ignored. Rust gives a warning if you dont handle such a result and in zig you must capture the result of a function if it returns something. I do not really like these approaches and i think having such a function throw an error makes more sense but i dont really like how this is done on most exception based languages. I quite like the approach that swift takes where it has exceptions with syntactic sugar that you would often find in errors as values based languages.

Im curious to hear how other people feel about error handling for functions that mostly about their side effects so please let me know your thoughts!


r/ProgrammingLanguages • • Feb 23 '26

The why and how of parallel in-place random-access accumulation

Thumbnail futhark-lang.org
15 Upvotes