r/ProgrammingLanguages • • 11h ago

EasyC, C made easy

I'm working on EasyC, a mostly statically typed, garbage-collected, interpreted programming language with familiar C-style syntax. The idea is to retain the things people like about C while removing some of its biggest pain points: no manual memory management, no pointer arithmetic, garbage collection, bounds-checked slices, static typing by default, checked conversions instead of undefined behavior. Another major goal is making it embeddable in applications through a C-friendly API, somewhat like Lua.

struct Point {
    float x;
    float y;
}

fn float Point::length(const self) {
    return std::sqrt(self.x * self.x + self.y * self.y);
}

fn int main() {
    let Point p = Point{ .x = 3.0, .y = 4.0 };
    std::print(convert!(string, p.length()));
    return 0;
}

It's still in early development, and the interpreter isn't functional yet. I'm currently interested in getting feedback on the language syntax. I'd love to hear what you think, especially from people experienced with language design and compiler development.

0 Upvotes

10 comments sorted by

44

u/Spyromaniac666 11h ago

No manual memory management and no pointer arithmetic? How is that retaining the things people like about C?

12

u/trollol1365 11h ago

Sorry what do you think people like about C that you are preserving here that other languages dont already offer? Such as Rust/C++ or even languages like Java that have C-style syntax?

7

u/funbike 10h ago edited 10h ago

Sounds like Go, but 20x slower.

This is a great hobby project, but don't expect people to use it. How is your language better than Go?

I think you might have gotten upvotes if you had said this was a personal project to learn about compilers. But you framed it as something you want people to use. That won't happen with the current direction that's similar to 100+ other similar projects. Yours has nothing new.

7

u/TheChief275 9h ago

This screams like an AI slop post; (1) your title is clickbaiting it to be like C but the language already looks more syntactically quirky than it for little reason, (2) if you say "static typing by default" is what your language provides over C, than that is stupid because C is already a statically typed language. Do you even know C?

5

u/nacnud_uk 11h ago

If you can do anything, avoid all of the mistakes that C++ made with objects. That should start with ::...is it an object, a namespace? And don't use & in a billion different ways. Just use keywords or something like that.

And with your example, it's really hard to tell, with no syntax highlighting, that the function is part of the Point.

I don't get languages that like to make me type the same shit, over and over again.

Pint::function1
Pint::function2
Pint::function3

Notice the crap that I have to type, again and again and again, and again. You get my point.

And why "fn"? So your language makes my typing even more redundant?

fn Pint::function1
fn Pint::function2
fn Pint::function3

I think I'd get bored too easily. EasyC, but for whom? Maybe AI till love burning these tokens. You working for Anthropic?

4

u/Key_Detail15 7h ago

with familiar C-style syntax.

Half of all languages have C-style brace syntax!

Your language is not C, the syntax is incompatible, and major C features are missing. The problem is calling it 'EasyC': people not going to learn C via your language. The name is a distraction and is misleading.

BTW here is your example in actual C:

typedef struct {
    float x;
    float y;
} Point; 

float Point_length(Point self) {
    return sqrt(self.x * self.x + self.y * self.y);
}

int main() {
    Point p = { .x = 3.0, .y = 4.0 };
    printf("%f", Point_length(p));
}

This has a character count of 230; yours is 265. By this measure, C is simpler!

2

u/tigrankh08 11h ago

This looks very Rust-inspired while also not being all the way there (e.g. types being on the left). While I'm against crystallized and rigid ways of thinking, I think lots of people would agree with me.

2

u/tigrankh08 10h ago

And P.S. I think people shouldn't design general-purpose programming languages around certain implementation ideas (like assuming being interpreted) but that's none of my business if you decide to look at it that way. I just advise against it

2

u/GunpowderGuy 10h ago

what would be the point of using this language ?