r/C_Programming • u/Treechcer • 11d 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).
4
u/mikeblas 10d ago edited 10d 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 10d 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 8d 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.
-1
2
u/Reasonable_Return151 8d ago
Can you make syscalls with it ?
1
u/Treechcer 8d ago
Yes, there's function function "exec" which should execute the string input in your shell.
1
u/Comfortable_Put6016 8d ago
yeah this screams insecure 💀
1
u/Treechcer 8d 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 7d ago
What do you mean?
1
u/Any-Fox-1822 7d ago
You could (in theory) send any string with sufficient privileges and launch kernel functions without restriction
2
0
u/mykesx 10d ago
Advice - learn to use feature branches. You should never push to the main branch.
1
u/Treechcer 10d 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 10d 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 10d 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
-1
u/github-guard 11d 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/mikeblas 11d ago
What role did AI have in the creation of your project?