This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,8 @@
.PHONY: all clean
all:
../cppo debug.ml > debug.out
../cppo french.ml > french.out
ocamllex lexer.mll
../cppo lexer.ml > lexer.out
clean:
rm -f *.out lexer.ml

View file

@ -0,0 +1,7 @@
#ifdef DEBUG
#define debug(s) Printf.eprintf "[%S %i] %s\n%!" __FILE__ __LINE__ s
#else
#define debug(s) ()
#endif
debug("test")

View file

@ -0,0 +1,32 @@
(ocamllex lexer)
(rule
(deps
(:< debug.ml))
(targets debug.out)
(action
(with-stdout-to
%{targets}
(run %{bin:cppo} %{<}))))
(rule
(deps
(:< french.ml))
(targets french.out)
(action
(with-stdout-to
%{targets}
(run %{bin:cppo} %{<}))))
(rule
(deps
(:< lexer.ml))
(targets lexer.out)
(action
(with-stdout-to
%{targets}
(run %{bin:cppo} %{<}))))
(alias
(name DEFAULT)
(deps debug.out french.out lexer.out))

View file

@ -0,0 +1,34 @@
#define soit let
#define fonction function
#define fon fun
#define dans in
#define si if
#define alors then
#define sinon else
#define Liste List
#define Affichef Printf
#define affichef printf
#define separation split
#define tri sort
soit rec separation x = fonction
y :: l ->
soit l1, l2 = separation x l dans
si y < x alors (y :: l1), l2
sinon l1, (y :: l2)
| [] ->
[], []
soit rec tri = fonction
x :: l ->
soit l1, l2 = separation x l dans
tri l1 @ [x] @ tri l2
| [] ->
[]
soit () =
soit l = tri [ 5; 3; 7; 1; 7; 4; 99; 22 ] dans
Liste.iter (fon i -> Affichef.affichef "%i " i) l;
Affichef.affichef "\n"

View file

@ -0,0 +1,9 @@
(* Warning: ocamllex doesn't accept cppo directives
within the rules section. *)
rule token = parse
['a'-'z']+ { `String (Lexing.lexeme lexbuf) }
{
#ifndef NOFOO
let foo () = ()
#endif
}