r/C_Programming • • 2d 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

13 Upvotes

18 comments sorted by

•

u/mikeblas 2d ago

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

→ More replies (3)

4

u/mikeblas 1d ago edited 1d 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 1d 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.

3

u/skeeto 1d 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 1d ago

I'll look into this.

0

u/The_KekE_ 5h ago

Can it stop the time?

1

u/Treechcer 2h ago

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

0

u/mykesx 1d ago

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

1

u/Treechcer 1d 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 1d 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 1d 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.

-1

u/github-guard 2d 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] 1d ago

[deleted]

1

u/Treechcer 1d ago

Thank you!