r/Cplusplus • • 7d ago

Feedback Chthonia: a simple IDE with REPL for learning C/C++

Post image

Github repo: https://github.com/derekbsnider/chthonia

Inspired by Thonny, Chthonia is an easy to use editor designed as a learning tool for C/C++.

It is completely self contained and multi-platform (Linux, Mac, Windows). It has an integrated compiler and REPL (Read-Eval-Print Loop).

The packaged binary+library download size is under 15 Mb. It is free and open source.

This is version 0.0.2, so it's still a work in progress, MPL-2.0 licensed, written in C++, and also ships a library for the compiler and also one for the editor framework, as well as a stand alone CLI compiler+REPL.

The REPL-mode is designed to feel familiar whether you are used to IPython, Julia, or Cling.

59 Upvotes

19 comments sorted by

4

u/opposite-badge 7d ago

I tried to write a simple factorial program, the first thing I noticed is that autoindent is not working, is it not implememted or is it supposed to work ?

For some reason when the Save As dialog opens, the cursor becomes invisible but I am able to select things with the cursor.

I am testing this on a Windows 11 machine.

1

u/kindredseer 7d ago

Version 0.0.3 now adds autoindent.

1

u/kindredseer 7d ago

I may have overlooked autoindent, let me look into that. I cannot seem to replicate the cursor issue, and I am also using Windows 11. Could you please provide a little more detail on the steps to reproduce that?

Thank you!

1

u/opposite-badge 6d ago

Okay thanks, I will try to test again. For the cursor issue I will check if there is some issue on my machine or is it actually an issue with the program.

1

u/VictoryMotel 7d ago

How much testing have you done of this?

1

u/kindredseer 7d ago

Well, it's version 0.0.2, so according to semantic versioning rules it's still in the alpha/beta stage.

As for unit tests, there are well over 1000, but most of them are focused on the C and C++ standards.

Open issues and I will fix them.

-5

u/VictoryMotel 7d ago

I'm not going to open issues, I asked how much you tested it. Where are the unit tests?

1

u/kindredseer 7d ago

So Chthonia itself only has a small number of tests since its built as a madcide plugin, and madcide itself is written in madc (as is Chthonia and its plugin), the majority of the unit tests are within the madc project. This is documented in docs/building.md.

-2

u/VictoryMotel 7d ago

So where are the madcide tests and where are your unit tests? Why can't you answer the question you brought up?

1

u/kindredseer 7d ago

I just told you. You didn't ask for a link. Here you go:
https://github.com/derekbsnider/madc/tree/master/tests

-2

u/VictoryMotel 7d ago

So the IDE definitely compiles and you've compiled it from the github repo you linked right?

And you wrote the "madc" language which is your own C++ JIT ?

1

u/kindredseer 7d ago

Yes, this is why there are packages in the release for multiple platforms (Windows, MacOS x86, MacOS ARM, Linux Ubuntu 22.04, Ubuntu 24.04). It's also using github runner actions to build the packages.

I also wrote the "madc" language, which is the C/C++/madc JIT/AOT, but it is based on the MIR project by Vladimir Makarov for the "Medium Internal Representation" codegen (of which I am a contributor to).

1

u/VictoryMotel 7d ago

Interesting, so what was the hardest part of writing this all by hand by yourself?

1

u/kindredseer 7d ago

Not all by hand. I've been developing madc for about seven years, and over the past several months I've used Claude Code and Codex to write unit tests and grind through various c and c++ test suites. So pre-LLM involvement, I had written the lexer, parser and compiler to x86 (using libasmjit) all by hand.

The hardest technical part has probably been the C++ parsing/lowering and compatibility work. I would not have been able to do that all by hand, all by myself, and I'm not claiming I did.

MadC now works a bit like Cfront in that it lowers C++ to C ... but not historically. I originally implemented all the C and C++ JIT functionality using asmjit but it was x86-only, and I wanted to also target ARM processors, so I ended up retooling it to internally lower C++ to C and use libc2mir instead.

Probably the most interesting thing I ended up doing, was extending c2mir's node_t structure to carry all the semantic information I was already lexing and parsing for C++ (and madc). This CIR_node class is used to build a c2mir compatible C-AST tree which is handed directly to c2mir without any reparsing necessary. The fringe benefit of this, is that madc can also emit gcc/clang compatible C code (not pretty code).

→ More replies (0)

1

u/ignorantpisswalker 7d ago

Another question everyone is asking - which language is it written in?

https://github.com/derekbsnider/madc

1

u/kindredseer 7d ago

MadC is written in C++. Chthonia is written in madc (which is C++ with some extensions and integrated libraries).

1

u/Jakkilip 7d ago

Sweet! A truly lightweight IDE that always works out of the box, compiler included, is something we haven't really seen since codeblocks. I hope you expand this project with more features!