# Suggestions on compiling DSL to LLVM

**URL:** <https://racket.discourse.group/t/suggestions-on-compiling-dsl-to-llvm/1953>\
**Category:** Languages\
**Created:** [May 16, 2023, 5:18pm UTC](https://racket.discourse.group/t/suggestions-on-compiling-dsl-to-llvm/1953 "2023-05-16T17:18:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_D](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ivan_d/32/1159_2.png) [@Ivan\_D](https://racket.discourse.group/u/Ivan_D)\
**Post date:** [May 16, 2023, 5:18pm UTC](https://racket.discourse.group/t/suggestions-on-compiling-dsl-to-llvm/1953/1 "2023-05-16T17:18:09Z")

</div>

Hello, Racketeers!

I am trying to implement a small DSL targeted to LLVM and am having trouble finding the right resources. I have looked into several LLVM projects, but most of them appear to be abandoned or lack sufficient documentation. Here are a few of the projects I have found:

> **[GitHub - rjnw/sham: A DSL for runtime code generation in racket](https://github.com/rjnw/sham)**
>
> A DSL for runtime code generation in racket. Contribute to rjnw/sham development by creating an account on GitHub.

This library looks promising, but there is no documentation available. There are two example languages included, but there are no so much comments on what they are intended to do.

> **[GitHub - endobson/racket-llvm: Bindings for llvm in racket](https://github.com/endobson/racket-llvm/)**
>
> Bindings for llvm in racket. Contribute to endobson/racket-llvm development by creating an account on GitHub.

This repository has an interesting N-body example, and the examples are explained. However, the repository is 10 years old and the LLVM API has changed significantly since then.

> **[GitHub - bubba/racket-llvm: LLVM bindings for Racket](https://github.com/bubba/racket-llvm/)**
>
> LLVM bindings for Racket. Contribute to bubba/racket-llvm development by creating an account on GitHub.

This is a very low level project, with not many examples.

Do you know of any other projects or tutorials that could be useful? Any suggestions are welcome. Thank you!

---

<div class="post-metadata">

**Author:** ![SamPhillips](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samphillips/32/15_2.png) [@SamPhillips](https://racket.discourse.group/u/SamPhillips)\
**Post date:** [May 17, 2023, 1:35am UTC](https://racket.discourse.group/t/suggestions-on-compiling-dsl-to-llvm/1953/2 "2023-05-17T01:35:04Z")

</div>

An approach that I briefly looked into was to generate LLVM assembler text and run `llvm-as`, `llc`, and `as` to generate a binary. This avoids having to deal with the FFI and the changing LLVM API.

---

<div class="post-metadata">

**Author:** ![Ivan\_D](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ivan_d/32/1159_2.png) [@Ivan\_D](https://racket.discourse.group/u/Ivan_D)\
**Post date:** [May 17, 2023, 8:15am UTC](https://racket.discourse.group/t/suggestions-on-compiling-dsl-to-llvm/1953/3 "2023-05-17T08:15:34Z")

</div>

Well, you suggest to not to use bindings at all? I thought, maybe, someone has used sham language or something similar.
