[LLVMdev] Generating code for Sequence expression

José Romildo Malaquias j.romildo at gmail.com
Wed Nov 14 13:47:28 PST 2012


Hello.

In order to practice compiler writing, I am implementing a simple
compiler for the Tiger language. I am using llvm IR for the intermediate
representation.

Regarding llvm, I have started by reading the OCaml version of the LLVM
Tutorial, where a compiler for the kaleidoscope language is built.

The language I am implementing has a form of expression called "sequence
expression". It is made up of a list of expressions:

  ( e1; e2; ... ; en )

To evaluate the sequence expression, each expression ei in the list is
evaluated in the order they appear, and the last one en gives the final
result.

How can the sequence expression be translated to the llvm IR?

After translating each expression ei from the sequence, how would the
resulting values be combined to evaluate in sequence?

If a more realistic scenario is needed, consider it as a new
construction from the kaleidoscope language used in the tutorial.

Romildo



More information about the llvm-dev mailing list