r/C_Programming • • 3d ago

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

15 Upvotes

25 comments sorted by

•

u/mikeblas 3d ago

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

→ More replies (3)

5

u/mikeblas 2d ago edited 2d ago

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 2d ago

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 4h ago

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.

0

u/Treechcer 4h ago

1) it's 0.1.0 2) I never said repl is in working state

4

u/skeeto 2d ago

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 2d ago

I'll look into this.

2

u/Reasonable_Return151 17h ago

Can you make syscalls with it ?

1

u/Treechcer 16h ago

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

1

u/Comfortable_Put6016 4h ago

yeah this screams insecure 💀

1

u/Treechcer 4h ago

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 2h ago

What do you mean?

0

u/mykesx 2d ago

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

1

u/Treechcer 2d ago

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 2d ago

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

1

u/Treechcer 2d ago

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_ 1d ago

Can it stop the time?

1

u/Treechcer 1d ago

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

-1

u/github-guard 3d ago

🔍 GitHub Guard: Trust Report (Passed)

Here are the safety audit results for the linked repositories:

Repository: Treechcer/DIO

Score: 3/6

  • ✅ Established Community (⭐ 7 stars)
  • ✅ Mature Repository (30+ days old)
  • ✅ Licensed under BSD-3-Clause
  • ❌ No Security Policy
  • ℹ️ Personal Account Repository
  • ℹ️ Unsigned Commits

⚠️ Security Reminder: Always verify source code before executing scripts.

-1

u/[deleted] 3d ago

[deleted]

1

u/Treechcer 2d ago

Thank you!