Better types #15

Merged
alex-eg merged 27 commits from better-types into main 2025-10-30 16:05:44 +01:00

27 Commits

Author SHA1 Message Date
b3c5ef8dbb fix stray atavistic } in Readme 2025-10-30 16:05:14 +03:00
e152f3cf2f fix extra closing paren in Readme example 2025-10-30 16:04:05 +03:00
59337f71ab replace fold-right append with flatten in type-convert-to-c
They are not equivalent, but it'll be allright in this
case. Probably. Passes tests at least.
2025-10-30 12:24:38 +03:00
9cf0644622 add malformed fn form match case in fmt-c-writer
Spent like 10 minutes trying to understand why my fn pointer is being
fucked up in test case. Turned out I was missing return type, and
whole fn pointer type fall through down to defaut case.
2025-10-30 12:23:03 +03:00
a2ea1cc292 rewrite Todo -> TODO
for better searchig I guess?
2025-10-30 12:22:38 +03:00
3a9300ba72 optimize fmt-c-writer type unwrapping 2025-10-30 12:22:18 +03:00
03684bb687 fix Readme typos 2025-10-30 12:21:31 +03:00
Ekaterina Vaartis
c48ebc7585 fix nested types producing wrong C code 2025-10-26 20:56:09 +03:00
1ca7e2ee15 enable semen-walk-form to embed results (for macro processing) 2025-10-26 11:39:00 +03:00
5379631471 move recons to utils 2025-10-26 11:37:52 +03:00
316ead4b37 add define support 2025-10-22 22:33:18 +03:00
c7d91eed2c add enum support 2025-10-22 22:33:18 +03:00
b379aae8b6 add c-or/c-bit-or/c-bit-or= support 2025-10-22 22:28:37 +03:00
7a21316c10 fix designated initializer assignment producing extra parens 2025-10-22 22:27:50 +03:00
9e44e3d0e8 fix structure attributes 2025-10-22 18:20:29 +03:00
39eb1c58a8 fix fmt-c while without body 2025-10-22 18:20:12 +03:00
bca857de3a add initial prelude 2025-10-22 17:29:53 +03:00
98a1d9f2e8 add typedef support 2025-10-22 17:29:42 +03:00
e7122bdbd5 fix arrays of structs, multiple struct fields with same type 2025-10-22 16:59:15 +03:00
d71bb97126 update Readme 2025-10-22 12:49:21 +03:00
4273d7bfd4 overhaul fmt-c-writer completely
It now looks very nice.
2025-10-21 22:24:57 +03:00
9e79ac5f9f prettify reader test with a nice macro 2025-10-21 22:24:57 +03:00
d11de327be move Sex to better types
Types, fns and vars are now written in another, better, more intuitive
and readable way.

Types:
"pointer to const char" is "* const char"
"array of pointers to volatile int" is "[* volatile int]"
Read left to right

Vars (as well as fn args, struct fields):
(var name type)
(struct vec3 ((x float) (y float) (z float))
(fn vec3-add ((v1 vec3) (v2 vec3)) vec3 ...)

Also fns are now have return types after arg list.

* is now must not be attached to any type name (or variable for that
matter)
2025-10-21 22:24:57 +03:00
0824091469 fix variuos struct-related issues in fmt-c
There were bugs, when struct in arg list and pointers to structs among
struct fields produces such code as:

(fn puk ((arg (* struct foo))) ...) -> void puk(struct foo { *; } arg)

(struct l ((next (* struct l)))) -> struct l { struct l { *; } next };

And so on.
2025-10-21 22:24:57 +03:00
6d2f7179c1 move basic and semen tests to groups 2025-10-21 22:24:56 +03:00
4165fbe299 add reader syntax for []
Now [...] reads to (¤ ...) for easy semantic processing
2025-10-21 22:24:26 +03:00
cca63fb4df add couple list utils
list-split and list-join
2025-10-21 21:21:10 +03:00