zetzit / zz

πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C
MIT License
1.6k stars 52 forks source link

Back to C Syntax? #18

Closed aep closed 4 years ago

aep commented 4 years ago

ZZ over time has derived from C. Some things are for good reasons, but some are mostly just because i don't personally like the C syntax. this might create an unnecessary barrier from C to ZZ.

an examples of necessary changes are function type declarations. the C syntax is ambiguous and near impossible to parse.

An example of a change that i did simply because i just like rust syntax more is struct initialization.

I'd like to collect feedback on ZZ's syntax and the biggest changes versus C which may be a porting barrier.

https://www.reddit.com/r/zzlang/comments/f0ai54/back\_to\_c\_syntax

benman1 commented 4 years ago

It's a shame you never got any feedback. This project looks awesome in the real sense of the word. It'd be good to see more documentation about the language, transpiler options, the current status (alpha?), and an awesome-zz page with links to projects using zz. I haven't used the language/transpiler, but I might use it in the future. More to your question, the syntax looks really clean - similar to C, but with some cleanups and updates.

benman1 commented 4 years ago

I looked a bit more; I still think you deserve more feedback, so I am just babbling on. The core language documentation looks excellent (I really like the tail variants!), but there's nothing about the standard library (modules). I see that there is very useful functionality such as sockets or strings, but I am finding that the module code is hard to read (on github) because of the lack of syntax highlighting. What I'd love to see are data structures such as lists and hashmaps, and unicode string support (wchar*).

aep commented 4 years ago

thanks!

but I am finding that the module code is hard to read

yes, autogenerated html docs and a searchable module website (like npm) are coming

What I'd love to see are data structures such as lists and hashmaps

that's a difficult topic. the standard library cannot have those, because it is allocation-free. I understand most people will need more learning resources to understand how to write heap free code

unicode string support (wchar*)

i don't really know much about unicode strings. Is there an API that you think is a good match?

benman1 commented 4 years ago

Thanks for getting back.

In C++, std::wstring is a wrapper for wchar_t similar to std::string which is a wrapper for char. wchar_t is defined in C as well [1]. A similar API in C is Glib::ustring.

The major difference to std::string is that a character is defined by 4 bytes rather than 1.

aep commented 4 years ago

right. feel free to open a new github issue for unicode string support.

i don't think i'll get to it soon, but maybe someone else with an understanding of unicode wants it too

benman1 commented 4 years ago

Thanks! Will do.

jwerle commented 4 years ago

@aep @benman1 I did a little work over here: https://github.com/jwerle/libutf8 and would be happy to help start something

benman1 commented 4 years ago

Hi Joseph I looked at bit at your library. I think it could form the basis of a wstring/ustring library. What I was thinking about was wide characters, so you can iterate over characters, do tolower() and a few other operations at the character level.


On Mon, 30 Mar 2020 at 18:21, Joseph Werle notifications@github.com wrote:

@aep https://github.com/aep @benman1 https://github.com/benman1 I did a little work over here: https://github.com/jwerle/libutf8 and would be happy to help start something

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aep/zz/issues/18#issuecomment-606131675, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSJO7ACQ4PYLQ24NJ6WGJDRKDILPANCNFSM4KROQK6Q .