unclad5968 6 days ago

I've never written a parser for any of those languages but my intuition is that Go is easier to parse than C. The others are debatable. Rust macros are definitely not simpler than C macros. I'm not sure what could be simpler than text substition. Zig doesn't have macros and comptime is implemented as a language VM that runs as a compilation step(last I knew), so that's definitely not simpler. I don't use go often, but I don't think it has macros at all so that's definitely simpler.

When people say that C is a simple language, my interpretation is that they mean it is easy to interpret what a C program does at a low level, not that it is simple to write.

1
mort96 6 days ago

The other languages can be written by a parser. A parser for C needs a semantic analyzer working in tandem.

The C preprocessor is not text substitution.

It is not easy to describe what C does at a low level. There are simple, easy to describe and wrong models of what C does "at a low level". C's semantics are defined by a very difficult to understand standards document, and if you use one of those simple and enticing mental models, you will end up with incorrect C code which works until you try a different compiler or enable optimisations.

uecker 5 days ago

A parser for C does not need a semantic analyzer. What C does it allows semantic analysis to be integrated into the parser.

The preprocessor has some weird behavior, it it is also not very complicated.

And I would argue that the abstract machine model of C is still relatively simple. There are are certainly simpler languages in this regard, but they give up one of the key powers of C, i.e. that you can manipulate the representation of objects on a byte level.

unclad5968 6 days ago

By that argument the other languages mentioned are impossible to understand since they don't have a spec, except for Go again.

mort96 6 days ago

No. The other languages have documented semantics too. Just happens that C's are in the shape of a standards document.