# Shared base library for PPL

**URL:** <https://discourse.julialang.org/t/shared-base-library-for-ppl/45901>\
**Category:** Probabilistic Programming\
**Created:** [September 1, 2020, 3:00pm UTC](https://discourse.julialang.org/t/shared-base-library-for-ppl/45901 "2020-09-01T15:00:59Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![phg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phg/32/17184_2.png) [@phg](https://discourse.julialang.org/u/phg)\
**Post date:** [September 2, 2020, 10:07am UTC](https://discourse.julialang.org/t/shared-base-library-for-ppl/45901/8 "2020-09-02T10:07:52Z")

</div>

> [@McCoy](#):
>
> One question for @phg - is it possible to construct this IR to be compatible with `IRTools` ?

You pretty much self-answerd that:

> [@McCoy](#):
>
> This is long-winded - but that being said, the `IRTools` IR will make writing these passes complicated. […] If we constructed a probabilistic IR which facilitated the writing of these passes, it would likely make this sort of technique more feasible, and likely enable more complex passes.

But certainly it would be very similar. I don’t think the IRTools representation lets you insert arbitrary values in all places, though, like `Expr` does – which would be needed to embed variable names and tildes. On the other hand, you’re of course right in that a lot of the static analysis facilities would have to be duplicated in an “extended rewrite”.

I imagine using this kind of system in a way that the PPL IR would then be lowered very easily to IRTools IR or CodeInfo, but with the variable names removed and the tildes converted to assignments plus a couple of calls. The other direction of conversion I guess would only be necessary to insert SSA statements, and that should be doable.

---

_[View the full topic](https://discourse.julialang.org/t/shared-base-library-for-ppl/45901)._
