r/C_Programming • • Oct 03 '26

Project Dio: Small Programming language made in C version 0.1.0 release

Hi, I'm working on my own programming language, I've release first stable version (v 0.1.0), I'd like to get feedback. It's on most OS platforms (even Andoird and in the future IOS).

Repo: https://github.com/Treechcer/DIO

18 Upvotes

28 comments sorted by

•

u/mikeblas Oct 03 '26

What role did AI have in the creation of your project?

→ More replies (3)

5

u/skeeto Oct 04 '26

Enable sanitizers (asan, ubsan, msan) when you test. There are buffer overflows an initialized variables on every run, and this will let you find and fix them quickly.

2

u/Treechcer Oct 04 '26

I'll look into this.

4

u/mikeblas Oct 04 '26 edited Oct 04 '26

Doesn't support parenthesis, I guess?

$ ./dio
DIO REPL>> int a = 10;
DIO REPL>> out(a)
10.0
DIO REPL>> int b = (3 + 9);
Segmentation fault (core dumped)

could use better error handling:

mikeb@scope:~/DIO$ ./dio
DIO REPL>>
DIO REPL>>
DIO REPL>> int a = 3/0;
File '' not found.mikeb@scope:~/DIO$

Are semicolons necessary? Some example use them, some don't.

I can't get the for loop example to work:

mikeb@scope:~/DIO$ ./dio
DIO REPL>> for (int i = 0; i < 10; i = i + 1)
DIO REPL>>    out(i)
10.0
DIO REPL>> end
ERR: 45 : 46
ERR: end (ID: 16)
In file: /home/mikeb/DIO/REPL.dio 1:1 in line 2
Generic error
in process: ast.c
mikeb@scope:~/DIO$

2

u/Treechcer Oct 04 '26

REPL isn't fully finished, I would fully use it. With semicolons I'm inspired from JavaScript I think, where it's needed only if you do two statements (eg. If you would want to increase variable and print it on one line you'd need to write 'var = car + 1; out(var);'. Also that for loop thingy doesn't work because it's you're doing it on many lines, it should be as *for(int i = 0; i < 10; i = i + 1); out(I); end" (one line, not 3 in repl, because repl takes it as the whole input which breaks it... Although, REPL is broke entirely....).

I'll look into the parentheses, it should work.

2

u/Patzer26 Oct 06 '26

Then why even post if basic ass things are not even working? Complete it, take your time, atleast make sure the the fucking example works, then post.

→ More replies (1)

2

u/Reasonable_Return151 Oct 06 '26

Can you make syscalls with it ?

1

u/Treechcer Oct 06 '26

Yes, there's function function "exec" which should execute the string input in your shell.

1

u/Comfortable_Put6016 Oct 06 '26

yeah this screams insecure 💀

1

u/Treechcer Oct 06 '26

Well, you should never execute any code someone tells you without being 100% sure it's safe, which is done either by reading source or by looking if others believe it.

1

u/mikeblas Oct 06 '26

What do you mean?

1

u/Any-Fox-1822 Oct 07 '26

You could (in theory) send any string with sufficient privileges and launch kernel functions without restriction

1

u/rxvy7 Oct 07 '26

That sounds actually pretty cool do you already know like how ur gonna print stuff or wait a time before u sleep and make it so u don't have to include anything?

0

u/mykesx Oct 03 '26

Advice - learn to use feature branches. You should never push to the main branch.

1

u/Treechcer Oct 04 '26

I mean, you're right. Like I know how to use them, I'm just lazy to do it or something. But yes I should.

0

u/OffensiveWord69 Oct 04 '26

Okay cool project. This is something I've wanted to try for awhile. What resources/books did you use to help?

1

u/Treechcer Oct 04 '26

I've watch first 3 episodes or so from this YouTube series . I also used some other resources, like stack overflow or Wikipedia... Also, I've read first few pages from 'crafting interpreters' I think it's called. So most of the stuff I've made is probably bad because I "invented" them.

0

u/The_KekE_ Oct 05 '26

Can it stop the time?

1

u/Treechcer Oct 05 '26

It's Dio as Diogenés de Sinape not as JoJo reference.

0

u/[deleted] Oct 03 '26

[deleted] — view deleted comment

1

u/Treechcer Oct 04 '26

Thank you!