Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 1.33 KB

README.md

File metadata and controls

28 lines (22 loc) · 1.33 KB

COMP31311 langs

A rust based parser and library for the languages we study in COMP31311

Examples

All examples can be found in the /examples directory, and can be run like so:

cargo run --example <example_name>

Latexify example

This example program highlights the occurances of variables at a certain depth.

comp31311_langs on  main [?] is 📦 v0.1.0 via 🦀 v1.65.0 took 2s
➜ cargo run --example=latexify -- --term 'z\y.y\x.x\x.xyz' -c x:1:red -c x:2:blue -c z:0:brown -c y:1:orange --output
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/examples/latexify --term 'z\y.y\x.x\x.xyz' -c 'x:1:red' -c 'x:2:blue' -c 'z:0:brown' -c 'y:1:orange' --output`
\textcolor{brown}{z}\lambda \textcolor{orange}{y}.\textcolor{orange}{y}\lambda \textcolor{red}{x}.\textcolor{red}{x}\lambda \textcolor{blue}{x}.\textcolor{blue}{x}\textcolor{orange}{y}\textcolor{brown}{z}

comp31311_langs on  main [?] is 📦 v0.1.0 via 🦀 v1.65.0
➜ latexrun out.tex

comp31311_langs on  main [?] is 📦 v0.1.0 via 🦀 v1.65.0
➜ z out.pdf

This results in the following when rendered with default latex + xcolor:

A lambda calculus expression where the variables at different levels have been coloured.