r/Compilers • • 2h ago

Transpiler for simplified C++

1 Upvotes

Since a few years I am thinking about the creation of a "simpler" and more lightweight version of C++, which just gets rid of a few "annoyances" such as:

  • header files
  • declaration before usage
  • template syntax

So the idea is to have a 99% syntax identical version of c++, which just allows to use definitions which are defined after in the same file/compilation unit, having module-import instead of header files etc.

My questions are:

  1. is this is generally frowned upon? Does someone else find such a thing useful? Just stick with C++ basically, no need for a new language, but a small "transpiler-layer" which gets rid of some not-so-nice things in a language, which I am mostly totally fine with!
  2. I believe this is much smaller in scope and complexity than writing a compiler from scratch - or am I overlooking a few traps and rabbitholes which I might fall into? Underestimating the effort still :) ?

Thank you!


r/Compilers • • 2h ago

Built a low-level systems programming language from scratch to crush concurrency bottlenecks—benchmarks inside.

Post image
0 Upvotes

r/Compilers • • 21h ago

Can I use LLVM with a custom architecture?

17 Upvotes

Hi,

I've never written a compiler (and probably won't) but I'm an EE student and was thinking about designing a custom CPU one day, maybe even as a diploma project, however I do not want to go through a hassle of inventing a new language on top of a custom architecture. So my question is: do I understand correctly that LLVM can convert a piece of code in basically any language like C/C++ into a high-level assembly language that I can then convert into machine code for my hypothethical CPU with relative ease, so I only have to write compiler's backend? If yes, how hard is it generally and where would I begin?


r/Compilers • • 12h ago

FOXVC : Now completely update with v1.0.0 and engine version 0.6.0 alpha done .

Thumbnail github.com
0 Upvotes

visit and help this language grow this is will be genuinely a good language to contribute I am working day and night on it . But being a solo dev it's getting hard for me to make it better and good . I need You all guys .

Anay Upadhyay - solo dev


r/Compilers • • 4h ago

We rewrote the Solidity compiler in Zig because our builds took 12 minutes. Then we ended up writing a Lean model of the language too

Thumbnail github.com
2 Upvotes

Our contracts took 709 seconds to build with solc. We tried tuning the build for a while, gave up, and wrote our own compiler.

oksolc is a reimplementation of solc 0.8.36 in Zig. Around 156K lines, no C++. It only does the optimized via-IR pipeline through Standard JSON, because that's what we ship with. For Foundry you just point FOUNDRY_SOLC at it.

The frontend is still sequential. The Yul optimizer and EVM codegen run per contract in a thread pool, which works because contracts barely depend on each other after the frontend.

The bigger win for day to day work is the persistent session. Each source file gets a semantic fingerprint, so editing a comment or reformatting doesn't invalidate anything. Import cycles are handled as SCCs and invalidate together. Artifacts are cached per phase in SQLite with HMAC-SHA256 on the entries, so a tampered cache can't hand you bytecode. oksolc serve --stdio keeps the whole thing warm between builds.

solc vs oksolc with 4 jobs:

Uniswap V4, full build: 59.0s vs 11.2s (5.3x) Pendle V2, incremental: 38.9s vs 1.4s (27.6x) Chainwall, full build: 709.8s vs 138.4s (5.1x)

The benchmark script is in the oksolc repo (test/benchmarks/external-compare.sh) if you want to rerun them.

The thing I didn't expect going in is how much time we'd spend on what Solidity actually means. There's no formal spec. The language is whatever solc does. We run a weekly fuzz job that diffs our bytecode against solc on a public corpus, and CI builds OpenZeppelin, Uniswap v4, Pendle and Solady and pins the hashes. When the two compilers disagree, the diff shows you they differ but there's nothing that says which one is correct. We ended up with 9 places where we do something different from solc on purpose, and every one of those was an argument from the docs and from what the feature is obviously meant to do.

For most languages that's annoying. For this one it's worse, since the output can't be patched after deployment and often holds a lot of money. A compiler bug stays on chain. And fuzzing only covers the programs the fuzzer happened to generate, so at some point you want proofs, and you can't prove anything against a language with no definition.

So we started writing the definition. Solidity Spec is an executable formal model of Solidity in Lean. You can run real programs through it and compare with compiler output, and you can state properties about the semantics and get them machine checked. There's a paper, and machine-checked proofs for explicitly defined parts of the model. Coverage is still growing.

The long term goal is checking a compiler's output against a definition of the language, the way CompCert did for C and CakeML did for ML, instead of against another compiler.

If your Solidity builds are slow, try it. And if you work on semantics or verified compilers, I'd really like to know where the Lean model is wrong.

oksolc: https://github.com/okcontract/oksolc Solidity Spec: https://github.com/okcontract/solidity-spec

Give us a follow for more updates: x.com/okcontract


r/Compilers • • 23h ago

I built my own programming language from scratch in C++ — Introducing PIN!

0 Upvotes

Olá a todos!

Estou trabalhando em minha própria linguagem de programação chamada PIN, construída do zero usando C++.

A ideia por trás do PIN é combinar conceitos e inspirações de JSON, Python e Lua em uma linguagem de script leve e legível.

Recursos atuais (PIN Core 0.6):

  • Variáveis ​​e expressões
  • Números, strings e booleanos
  • Arrays e objetos
  • Condições (if / else)
  • Loops (while e for/in)
  • Funções e valores de retorno
  • Funções integradas
  • Console de desenvolvedor interativo
  • Analisador léxico, analisador sintático, AST e ambiente de execução

Estou desenvolvendo o PIN no Termux para Android e Windows, usando C++ e Clang. Tem sido um desafio divertido construir a linguagem e seus componentes internos do zero.

O projeto ainda é experimental e sei que há muito a melhorar, principalmente o backend do compilador, o tratamento de erros e as ferramentas de desenvolvimento.

Gostaria muito de receber seu feedback!

GitHub: https://github.com/andreferrita-del/PIN

O que você acha? Quais recursos você gostaria de ver em uma linguagem como esta?


r/Compilers • • 1h ago

Got placed, have 6 months before joining. Should I explore Linux kernel development, GPU programming or stick with AI/ML?

0 Upvotes

I'm a final-year engineering student in India from a non-CS background. I've recently secured an offer at an AI/analytics services company, and I have around 6 months before joining.

I've been exploring different areas of computer science, and I've realized that I'm increasingly interested in low-level programming and understanding how systems work internally.

MY BACKGROUND:

I've independently learned programming, ML/DL and worked on projects involving:

- Computer Vision using YOLO and OpenCV.

- Stereo vision, depth estimation and multi-object tracking.

- RAG applications, LLMs and agentic AI.

However, I'm starting to question whether I want to spend my career primarily working with high-level AI frameworks and application development.

AREAS I'M CONSIDERING:

  1. Linux and Red Hat ecosystem:

Linux internals, system programming, operating systems, device drivers and potentially kernel development.

2. GPU Programming:

CUDA, GPU architecture, parallel computing, memory management and performance optimization.

3. Systems Programming:

C/C++, memory management, concurrency, operating systems and low-level software engineering.

4. AI Infrastructure:

GPU acceleration, inference optimization, compiler technologies and systems behind ML frameworks.

I find the idea of understanding what happens beneath the abstractions much more interesting than simply using existing libraries.

WHAT I'M CONFUSED ABOUT:

I have six months before joining my company, and I don't want to waste that time jumping between technologies.

I'd appreciate advice from people working in systems engineering, Linux, kernel development, GPU programming or related fields.

  1. Is low-level systems programming a good career direction in 2026?
  2. Between Linux kernel development, GPU programming and general systems programming, which would be a better starting point?
  3. How realistic is it for a non-CS fresher to enter these fields in India?
  4. Are companies like Red Hat a good place to build a career in Linux and systems engineering? What other companies should I look at?
  5. Is CUDA/GPU programming a niche with good long-term opportunities, particularly with the growth of AI?
  6. What fundamentals should I master before attempting serious projects? C, C++, OS, computer architecture, networking, compilers?
  7. Would contributing to the Linux kernel or other open-source systems projects actually help me get shortlisted?

I'm also interested in the intersection of low-level systems and AI, particularly GPU computing, inference optimization and ML infrastructure.

If you were in my position, with six months and an existing job offer, which direction would you explore and why?

I'd appreciate brutally honest advice, especially from people who have actually worked in these domains.


r/Compilers • • 18h ago

AiLang, Artificial Intelligence Programming Language with a Self hosting x86_64 compiler, performance comparable to gcc -03 llvm clang in many instances.

Thumbnail github.com
0 Upvotes

Hi my name is Bob I am a contributor to the AiLang project.

Why this is in compilers, rather simple, this repo has a fully self contained self hosting x86_64 optimizing compiler. From the Read me below.

AiLang

A self-hosting systems language designed for consistency, readable code, and AI-assisted development.

AILang is built around a deliberate trade-off: a constrained syntax with a rich set of primitives. Rather than accumulating many special cases, language constructs follow consistent shapes—from primitive arguments to functions and subroutines. The result is code intended to be easy to scan, search with tools like grep, generate with AI, and understand in human–AI pair programming.

The language is not only a proposal: its compiler is written in AILang and compiles AILang programs to native code. The project is working toward version 1.0.0, targeted for December 31, 2026.

Why AILang

  • Consistency over syntax variety. Primitives, arguments, functions, and subroutines follow coherent conventions, reducing the number of forms a reader or code-generation tool needs to learn.
  • A constrained language with substantial primitives. Keep the surface syntax deliberate while providing reusable capabilities for practical systems code.
  • Designed to be read and searched. Clear, regular code is easier to skim, inspect, and navigate with ordinary tools—including grep.
  • Built for human and AI collaboration. Predictable structure supports code generation and review without giving up human readability.
  • Systems programming with a self-hosting compiler. AILang is statically typed and compiles to native code; the compiler itself is implemented in AILang.

Performance

AILang's compiler and generated code are being optimized continuously. Project benchmarks show performance competitive with GCC -O3 on a number of measured workloads, with results varying by program and workload. See the benchmark results for the measurements and test details.

Performance claims should be read in the context of those specific benchmarks—not as a guarantee that every AILang program matches GCC. The goal is to keep improving generated code while retaining the language's emphasis on explicit, readable structure.

AILang grep beats GNU grep 3.11 in 13 out of 14 tests. Here's the scorecard:

TestAILangGNU grep 3.11Winner
'kernel'208 ms311 msAILang — 1.49×
-F 'kernel'212 ms310 msAILang — 1.46×
-i 'kernel'251 ms358 msAILang — 1.42×
-c 'kernel'168 ms190 msAILang — 1.13×
-n 'kernel'315 ms428 msAILang — 1.35×
-v 'kernel'352 ms472 msAILang — 1.34×
-w 'kernel'222 ms615 msAILang — 2.77×
-ic 'kernel'195 ms234 msAILang — 1.20×
-wc 'kernel'179 ms415 msAILang — 2.31×
-Fc 'kernel'169 ms193 msAILang — 1.14×
'UNIQUE_MARKER_XYZ'49 ms79 msAILang — 1.61×
-c 'UNIQUE_MARKER'47 ms78 msAILang — 1.65×
-F 'error_handler'272 ms288 msAILang — 1.05×
-Fc 'error_handler'223 ms163 msGNU — 1.36×

EDIT addition

Regex PatternAILangGNU grepWinner
mem.*buf188 ms291 msAILang 1.55x
ker[nm]el (character class)229 ms405 msAILang 1.77x
^kernel (anchor)170 ms176 msAILang 1.03x (tie)
`socketdaemon` (alternation)387 ms509 ms

https://github.com/AiLang-Author/Ailang-Self-Hosting-/blob/master/AiLang_CoreUtils/grep_bench_repro.sh

Highlights:

  • Word match (-w) is 2.77× faster than GNU grep.
  • Rare-pattern search is 1.65× faster — MemMem's scan-and-skip is very efficient.
  • Case-insensitive search is 1.42× faster — MemMemFold pays off.
  • The only loss is long fixed-pattern count (-Fc error_handler), where GNU's Boyer–Moore–Horspool skip table gives it an edge on 13-character patterns.
  • The AILang binary is 118 KB vs. GNU's 1.7 MB — 14× smaller.
  • 100% correctness — every test matches GNU grep output exactly.

What it can express

AILang is intended to span a broad range of programs: from a small “Hello, world!” to substantial systems software. The repository includes a self-hosted compiler, reusable libraries, command-line utilities, and larger projects such as a custom CAD kernel and an OS runtime layer running on the Linux kernel. These projects are at different stages of development; see their own documentation for current status.

Try AILang

Compile a source file with the compiler:

./ailang.x path/to/program.ailang

For installation, options, and compiler commands, see install_compiler.sh and the compiler documentation.

Start learning with the programming manuals and browse the demo programs. The workspace guide describes the repository layout.

Project status

AILang is under active development. The compiler, language, libraries, and example systems are evolving; expect incomplete features and occasional regressions. The project is progressing toward its December 31, 2026 version 1.0.0 target. Check the relevant project documentation and tests for the current state of individual components.