zapashcanon 5 months ago
parent
commit
33881e6221
Signed by: zapashcanon GPG Key ID: 8981C3C62D1D28F1
  1. 6
      TODO.txt
  2. 4
      dune-project
  3. 95
      src/CODE.md
  4. 80
      src/dune
  5. 10
      src/main.tex
  6. 19
      src/packages.tex

6
TODO.txt

@ -0,0 +1,6 @@
cohérence uk/us
specialised/specialized
monomorphise/monomorphize
voir papier kennedy+pierce

4
dune-project

@ -1,3 +1 @@
(lang dune 3.0)
(using mdx 0.2)
(lang dune 3.8)

95
src/CODE.md

@ -1,95 +0,0 @@
# C generic list
<!-- $MDX file=list.c -->
```c
// asking for an int version
#define TYPE int
#define TYPED(X) int_##X
// generic code
struct TYPED(list) {
TYPE head;
struct TYPED(list) * tail;
};
TYPE hd(struct TYPED(list) * l) {
if (l) { return l->head; }
_Exit(42);
}
```
```sh
$ cpp -P list.c
struct int_list {
int head;
struct int_list * tail;
};
int hd(struct int_list * l) {
if (l) { return l->head; }
_Exit(42);
}
```
```sh
$ gcc -c list.c
```
# D String Mixins
<!-- $MDX file=list.d -->
```d
template GenList(string Type) {
const char[] GenList =
"struct List_" ~ Type ~ " {\n" ~
" " ~ Type ~ " head;\n" ~
" " ~ "List_" ~ Type ~ "* tail;\n" ~
"}\n" ~
Type ~ " hd(List_" ~ Type ~ "* l) {\n" ~
" if (l) { return l.head; }\n" ~
" assert(0);\n" ~
"}";
}
mixin(GenList!("int"));
```
```sh
$ gdc -c list.d -fsave-mixins=/dev/stdout
// expansion at list.d:13:1
struct List_int {
int head;
List_int* tail;
}
int hd(List_int* l) {
if (l) { return l.head; }
assert(0);
}
```
```sh
$ gdc -c list_int.d
```
<!-- $MDX file=layout.py -->
```python
array1 = [1, 2, 3]
array2 = [42, 99, 666]
pair = (array1, array2)
x = 42
```
```sh
$ python layout.py
```
<!-- $MDX file=layout.ml -->
```ocaml
let array1 = [| 1; 2; 3 |]
let array2 = [| 42; 99; 666 |]
let pair = (array1, array2)
let x = 42
```

80
src/dune

@ -30,30 +30,34 @@
ral.rs.tex
styledef.tex)
(action
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/LaTeX Warning: There were undefined references/d")
(run sed "/Package biblatex Warning/d")
(run sed "/Output written/d"))))
(progn
(run rm main.aux)
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/LaTeX Warning: There were undefined references/d")
(run sed "/Package biblatex Warning/d")
(run sed "/Output written/d"))
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/LaTeX Warning: There were undefined references/d")
(run sed "/Package biblatex Warning/d")
(run sed "/Output written/d")))))
(rule
(targets main.bbl)
(deps bib.bib main.first.bcf)
(deps bib.bib main.aux)
(action
(run biber -quiet main.first.bcf --output-file main.bbl)))
(run bibtex main)))
(rule
(targets main.first.bcf)
(deps main.bcf)
(action
(run mv main.bcf main.first.bcf)))
(rule
(targets main.bcf)
(targets main.aux)
(deps
article.tex
bib.bib
figure_ocaml_bit1.mps
figure_ocaml_bit2.mps
figure_ocaml_bit3.mps
@ -81,19 +85,33 @@
ral.rs.tex
styledef.tex)
(action
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/Package hyperref/d")
(run sed "/LaTeX Font Warning:/d")
(run sed "/(Font)/d")
(run sed "/LaTeX Warning: Empty bibliography/d")
(run sed "/LaTeX Warning: There were undefined references/d")
(run sed "/LaTeX Warning: Citation/d")
(run sed "/Package rerunfilecheck/d")
(run sed "/Package biblatex Warning:/d")
(run sed "/Output written/d"))))
(progn
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/Package hyperref/d")
(run sed "/LaTeX Font Warning:/d")
(run sed "/(Font)/d")
(run sed "/LaTeX Warning: Empty bibliography/d")
(run sed "/LaTeX Warning: There were undefined citations/d")
(run sed "/LaTeX Warning: Citation/d")
(run sed "/Package rerunfilecheck/d")
(run sed "/Package biblatex Warning:/d")
(run sed "/Output written/d"))
(pipe-outputs
(run texfot xelatex -halt-on-error -shell-escape main.tex)
(run sed "/\\/usr\\/bin\\/texfot:/d")
(run sed "/This is XeTeX/d")
(run sed "/Package hyperref/d")
(run sed "/LaTeX Font Warning:/d")
(run sed "/(Font)/d")
(run sed "/LaTeX Warning: Empty bibliography/d")
(run sed "/LaTeX Warning: There were undefined citations/d")
(run sed "/LaTeX Warning: Citation/d")
(run sed "/Package rerunfilecheck/d")
(run sed "/Package biblatex Warning:/d")
(run sed "/Output written/d")))))
(rule
(targets list.c.tex)
@ -153,10 +171,6 @@
(action
(run pygmentize -O envname=BVerbatim ral.fsx -o %{targets})))
(mdx
(deps list.c list.d)
(files CODE.md))
(rule
(targets layout.py.tex)
(deps styledef.tex layout.py)

10
src/main.tex

@ -1,4 +1,4 @@
\documentclass{article}
\documentclass[nonacm]{acmart}
\input{packages.tex}
@ -9,10 +9,12 @@
\affil[1]{OCamlPro SAS, 21 rue de Châtillon, 75014 Paris, France}
\affil[2]{Université Paris-Saclay, CNRS, ENS Paris-Saclay, Inria, Laboratoire Méthodes Formelles, 91190 Gif-sur-Yvette, France}
\bibliography{bib}
\begin{document}
\bibliography{bib}
\bibliographystyle{plainnat}
\maketitle
\begin{abstract}
@ -23,6 +25,4 @@
\input{article.tex}
\printbibliography{}
\end{document}

19
src/packages.tex

@ -24,25 +24,6 @@
{\IfBooleanT{#1}{\textcolor{red}{\ttfamily\bfseries \$ }}%
\lstinline[language=sh,keywordstyle=\color{blue!35!white}\bfseries]^#2^}
\usepackage[
autolang=other,
backend=biber, % choix de l'outil de traitement
backref=true, % liens dans la bibliographie pour remonter dans le texte
backrefstyle=none, % afficher toutes les utilisations de la référence
bibstyle=alphabetic, % style pour les clés des références dans la bibliographie : [initialesAnnée]
citestyle=alphabetic, % style pour les clés des références dans le texte : [initialesAnnée]
%datamodel=software, % swh
sorting=ynt, % bibliographie triée par année, nom, titre
]{biblatex} % support des bibliographies
\usepackage{software-biblatex}
\ExecuteBibliographyOptions{
swhid=true,
shortswhid=true,
swlabels=true,
vcs=true,
license=false
}
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
%\setsansfont{TeX Gyre Heros}

Loading…
Cancel
Save