4 ms·
A Minimalist TypeScript for C
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
- brudgers 2y agohttps://github.com/galileolajara/cp1 https://github.com/galileolajara/cp1
- tzmlab 2y agoIs it possible to replace LibC? We'd like to test this on bare-metal target using newlib-nano.
- GLC-ninja 2y agoYes 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.
- rwbt 2y agoInteresting project, similar to Cake[0] [0] - https://github.com/thradams/cake https://github.com/thradams/cake
- lelanthran 2y agoTwo different overloads of '+' for a total of 3 different meanings for '+'. 4 if you include ++.
- dezmou 2y agoIs there another example that show how memory allocation work with pointers and stuff ?
- mbel 2y agoIt seems to work similarly as in C, i.e. you call malloc manually, there is some form of automatic size deduction though: https://github.com/galileolajara/cp1/blob/main/examples/04-variables.cp1 https://github.com/galileolajara/cp1/blob/main/examples/04-v...
- timz 2y agohttps://www.assemblyscript.org/ https://www.assemblyscript.org/ is somehow similar, but targets only webassembly now
- pmkary 2y agonice!
- WorldMaker 2y agoThis feels to me halfway to reinventing Pascal the long way around. Fascinating
- Gibbon1 2y agoIf Pascal had opted for BASIC's string types and phat pointers.
- billev2k 2y agoCrazy 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.
- leecommamichael 2y agoLooks like more of an idea than usable compiler. Generated parser and all.
- sparkie 2y agoWhat's wrong with a generated parser?