c-mera
datatype99
c-mera | datatype99 | |
---|---|---|
7 | 29 | |
383 | 794 | |
- | - | |
0.0 | 3.5 | |
over 1 year ago | 27 days ago | |
Common Lisp | C | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
c-mera
-
Submissions to Spring Lisp Game Jam 2023
Arguably Pacman Clone - it uses WISP (non s-exps syntax for any lisp) + C-Mera which is some kind of mix of C and CL, and is written mostly in CL.
-
Is there a language with lisp syntax but C semantics?
c-mera does exist.
-
jc - Meta-program C/C++ with JavaScript
Thanks, you're right. I chose JS because it is so well-known, but I think it does have some other advantages as well. For example, if you need to run a lot of compatibility test commands, or need to generate code via external programs, or even make network requests to get config values or something, you can do all of that in parallel with JS async instead of sequentially like configure. You might find https://github.com/kiselgra/c-mera interesting. It's similar to this project but uses Lisp and a unified syntax.
-
Generate C code
I used https://github.com/kiselgra/c-mera for this purpose and it worked very well.
-
Carp – A statically typed Lisp, without a GC, for real-time applications
That's a Lisp preprocessor for a non-Lisp language.
If you program in C using the Common Lisp c-mera preprocessor, or any of the other similar systems, it's the same thing.
You're writing everything in S-exps, and the expansions use conses, but the output is C; so that of course cannot call cons at run time.
https://github.com/kiselgra/c-mera
-
Syntatic Sugar that compiles to C
even more interesting are the handful of projects layering lisp style macros on top of C. i've seen several go by over the years; a quick google search brought up c-mera and cmacro.
-
Alternative to ECL?
If you look for lisp-like syntax in C: - cmera https://github.com/kiselgra/c-mera
datatype99
-
Future of high-level languages
Sum types and pattern matching have already been hacked together in a preprocessor macro in C; see https://github.com/Hirrolot/datatype99.
- So far there is no evidence that Rust adds any value here. And if C is missing certain features, they can be added.
-
Does C have an equivalent to an algebraic data type?
It does not. There are people who have implemented such constructs in C code however, for example: https://github.com/Hirrolot/datatype99
-
Memory Management Reference
Nice reference but with some strange bits:
> Algebraic data types are usually represented using a heap. Because of their non-uniformity, algebraic data types are more difficult to scan.
Using a heap??? We can represent ADTs using stack as well, that's what we usually do in C and Rust.
Shameless plug: https://github.com/Hirrolot/datatype99 (a library of mine that generates type-safe ADTs for pure C99).
-
Pretty-Printable Enumerations in Pure C
I agree; I would especially not recommend abusing macros throughout an application codebase too much. Conceptually, Metalang99 is more of a (sub)language than a library, which also adds some entry barrier. Ideally, I see the application of Metalang99 being used "behind the scenes", e.g., encapsulated in separate code files/libraries such as Datatype99 and Interface99. This is what I (mostly) do in SmolRTSP.
-
lipstick: a Rust-like syntax frontend for C
I've done something similar with Datatype99 and Interface99. They are like a macro eDSL that compiles to C. The first one features algebraic data types, the second one features interfaces.
-
Any alternative to vala?
If you need a bit more high-level constructions, you can use the Datatype99 and Interface99 libraries. The former provides polymorphism over data, the latter -- over behaviour (I am the creator of these libraries).
-
Syntatic Sugar that compiles to C
OP, you might find datatype99 and its sibling projects interesting, though they mostly leverage the C preprocessor without going all the way towards defining a new language.
-
AST Implementation in C
You can use Datatype99 to represent your AST tagged union conveniently.
-
Rust for Linux Redux
Compared to plain C, you have ADTs which help from day to day programming. You can bring them to C (https://github.com/Hirrolot/datatype99) but I don't know if the Linux guys would allow it.
What are some alternatives?
c2ffi - Clang-based FFI wrapper generator
metalang99 - Full-blown preprocessor metaprogramming
cl-raylib - Common Lisp binding of raylib
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
janet-benchmarksgame - Versions of the "Computer Language Benchmarks Game" benchmarks for the Janet language.
corrode - C to Rust translator
chibi-scheme - Official chibi-scheme repository
Cloak - A mini-preprocessor library to demostrate the recursive capabilites of the preprocessor
cmacro - Lisp macros for C
llvm-cbe - resurrected LLVM "C Backend", with improvements
cl-autowrap - (c-include "file.h") => complete FFI wrapper
epilepsy - A functional language for C99 preprocessor metaprogramming [Moved to: https://github.com/Hirrolot/metalang99]