A Minimalist TypeScript for C

44 points by GLC-ninja ↗ HN
A Minimalist TypeScript for C. Cp1, or C+1, or C plus 1 programming language adds only the bare essentials to C language that allows you to output C codes and able to use namespaces, modules, methods on enums/structs, auto variable deduction and more.

Github: https://github.com/galileolajara/cp1

16 comments

[ 3.9 ms ] story [ 53.5 ms ] thread
Is it possible to replace LibC? We'd like to test this on bare-metal target using newlib-nano.
Yes you can replace LibC. Just use "cp1 c" command to output C codes and then use appropriate command line arguments to gcc or clang to use newlib-nano. I cannot give direct instructions for you to use newlib-nano because I'm not yet familiar with that library.
Two different overloads of '+' for a total of 3 different meanings for '+'.

4 if you include ++.

This feels to me halfway to reinventing Pascal the long way around. Fascinating
If Pascal had opted for BASIC's string types and phat pointers.
Crazy usage of "+". Using "+" as a synonym for "var" seems pretty pointless. Suffix "+" to mean stack allocated (vs not yet allocated?), unless it's an array, in which case "+" means objects not pointers. Or so it seems.

And allowing the minus sign as an identifier character is just asking for errors.

Some nice ideas (member functions!). Love to see the next evolution.

Looks like more of an idea than usable compiler. Generated parser and all.
What's wrong with a generated parser?