Skip to content

Commit e36b1b8

Browse files
committed
Make readme_gen deal with subdirs and lem files
1 parent 6be70a8 commit e36b1b8

File tree

16 files changed

+128
-5
lines changed

16 files changed

+128
-5
lines changed

Holmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
INCLUDES = developers $(HOLDIR)/examples/formal-languages/context-free $(HOLDIR)/examples/fun-op-sem/lprefix_lub lem_lib_stub $(HOLDIR)/examples/machine-code/hoare-triple
22
OPTIONS = QUIT_ON_FAILURE
33

4-
README_SOURCES = mlstringScript.sml miscScript.sml COPYING developers build-instructions.sh
4+
README_SOURCES = mlstringScript.sml miscScript.sml COPYING developers build-instructions.sh lib.lem libScript.sml
55

66
THYFILES = $(patsubst %Script.sml,%Theory.uo,$(wildcard *.sml))
77
TARGETS = README.md $(patsubst %.sml,%.uo,$(THYFILES))

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,76 @@ Directory structure
2121
[COPYING](COPYING):
2222
CakeML Copyright Notice, License, and Disclaimer.
2323

24+
[basis](basis):
25+
Contains the beginnings of a standard basis library for CakeML,
26+
similar to the standard basis library of SML.
27+
2428
[build-instructions.sh](build-instructions.sh):
2529
This script installs Poly/ML, HOL and CakeML.
2630

31+
[candle](candle):
32+
Verification of a HOL theorem prover, based on HOL Light
33+
(http://www.cl.cam.ac.uk/~jrh13/hol-light/), implemented in CakeML.
34+
35+
[characteristic](characteristic):
36+
A verified CakeML adaption of Arthur Charguéraud's "Characteristic
37+
Formulae for the Verification of Imperative Programs"
38+
39+
[compiler](compiler):
40+
A verified compiler for CakeML, including:
41+
- parsing: lexer and PEG parser
42+
- inference: type inferencer
43+
- backend: compilation to ASM assembly language
44+
- targets: code generation to x86, ARM, and more
45+
46+
[developers](developers):
47+
This directory contains scripts for automating routine tasks, e.g. for
48+
running regression tests.
49+
2750
[developers](developers):
2851
This directory contains scripts for automating routine tasks, e.g. for
2952
running regression tests.
3053

54+
[documentation](documentation):
55+
Work-in-progress documentation regarding the CakeML language.
56+
57+
[explorer](explorer):
58+
Tools for stepping through execution of the compiler from one
59+
intermediate language to the next, and pretty-printing the
60+
intermediate results. An instance is available on the CakeML website.
61+
62+
[flame](flame):
63+
The start of a set theory formalisation that has net yet been used.
64+
65+
[lem_lib_stub](lem_lib_stub):
66+
Empty versions of the Lem libraries (which we don't use, but building
67+
with Lem requires)
68+
69+
[lib.lem](lib.lem):
70+
Extensions to Lem's built-in library to target things we need in HOL.
71+
3172
[miscScript.sml](miscScript.sml):
3273
Miscellaneous definitions and minor lemmas used throughout the
3374
development.
3475

3576
[mlstringScript.sml](mlstringScript.sml):
3677
Small theory of wrapped strings, so the translator can distinguish
3778
them from char lists and can target CakeML strings directly.
79+
80+
[semantics](semantics):
81+
The definition of the CakeML language. The definition is (mostly)
82+
expressed in Lem (http://www.cs.kent.ac.uk/~sao/lem), but the
83+
generated HOL is also included. The directory includes definitions of:
84+
- the concrete syntax
85+
- the abstract syntax
86+
- small step semantics
87+
- big step semantics (both functional and relational)
88+
- semantics of FFI calls
89+
- a type system
90+
91+
[translator](translator):
92+
A proof-producing translator from HOL functions to CakeML.
93+
94+
[unverified](unverified):
95+
Various unverified tools, e.g. tools for converting OCaml to CakeML
96+
and an SML version of the CakeML register allocator.

basis/readmePrefix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Contains the beginnings of a standard basis library for CakeML,
2+
similar to the standard basis library of SML.

candle/readmePrefix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Verification of a HOL theorem prover, based on HOL Light
2+
(http://www.cl.cam.ac.uk/~jrh13/hol-light/), implemented in CakeML.

characteristic/readmePrefix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
A verified CakeML adaption of Arthur Charguéraud's "Characteristic
2+
Formulae for the Verification of Imperative Programs"

compiler/readmePrefix

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
A verified compiler for CakeML, including:
2+
- parsing: lexer and PEG parser
3+
- inference: type inferencer
4+
- backend: compilation to ASM assembly language
5+
- targets: code generation to x86, ARM, and more

developers/readme_gen.sml

+32-4
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,17 @@ datatype res = TitleAndContent of string * (string list)
211211

212212
fun isError (Error _) = true | isError _ = false;
213213

214-
fun create_summary filenames = let
215-
val filenames = sort (fn s1 => fn s2 => s1 <= s2) filenames
214+
fun create_summary filenames_and_paths = let
215+
val filenames = sort (fn s1 => fn s2 => s1 <= s2) filenames_and_paths
216+
(* remove lem generated scrit files *)
217+
fun mem x [] = false
218+
| mem x (y::ys) = (x = y) orelse mem x ys
219+
fun is_lem_generated filename =
220+
if String.isSuffix "Script.sml" filename then let
221+
val str = String.substring(filename,0,String.size(filename)-10)
222+
in mem (str ^ ".lem") filenames end
223+
else false
224+
val filenames = List.filter (not o is_lem_generated) filenames
216225
(* read what needs to come first in the output *)
217226
val filename = PREFIX_FILENAME
218227
val header = Prefix (read_readme_prefix filename)
@@ -221,7 +230,8 @@ fun create_summary filenames = let
221230
fun do_filename filename =
222231
(if (OS.FileSys.isDir filename handle OS.SysErr _ => false) then
223232
TitleAndContent (filename,read_comment_from_dir filename)
224-
else if String.isSuffix ".sml" filename then
233+
else if String.isSuffix ".sml" filename orelse
234+
String.isSuffix ".lem" filename then
225235
TitleAndContent (filename,read_comment_from_sml filename)
226236
else if String.isSuffix ".sh" filename then
227237
TitleAndContent (filename,read_comment_from_script filename)
@@ -254,4 +264,22 @@ fun create_summary filenames = let
254264
val _ = TextIO.closeOut(f)
255265
in () end;
256266

257-
fun main () = (create_summary (CommandLine.arguments ()); ());
267+
fun all_nondot_subdirs () = let
268+
val d = OS.FileSys.openDir(OS.FileSys.getDir())
269+
fun all () =
270+
case OS.FileSys.readDir(d) of
271+
NONE => [] | SOME name => name :: all ()
272+
val names = all ()
273+
val _ = OS.FileSys.closeDir(d)
274+
val names = List.filter (fn n => OS.FileSys.isDir(n)
275+
handle OS.SysErr _ => false) names
276+
val names = List.filter (not o String.isPrefix ".") names
277+
in names end
278+
279+
fun main () = let
280+
val args = CommandLine.arguments ()
281+
val dirs = all_nondot_subdirs ()
282+
val _ = create_summary (args @ dirs)
283+
in () end;
284+
285+
val filenames_and_paths = ["../lib.lem", "../libScript.sml"]

documentation/readmePrefix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Work-in-progress documentation regarding the CakeML language.

explorer/readmePrefix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Tools for stepping through execution of the compiler from one
2+
intermediate language to the next, and pretty-printing the
3+
intermediate results. An instance is available on the CakeML website.

flame/readmePrefix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The start of a set theory formalisation that has net yet been used.

lem_lib_stub/readmePrefix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Empty versions of the Lem libraries (which we don't use, but building
2+
with Lem requires)

lib.lem

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
(*
2+
Extensions to Lem's built-in library to target things we need in HOL.
3+
*)
14
open import Pervasives
25
import List_extra
36
import String

libScript.sml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ val _ = numLib.prefer_num();
88

99
val _ = new_theory "lib"
1010

11+
(*
12+
Extensions to Lem's built-in library to target things we need in HOL.
13+
*)
1114
(*open import Pervasives*)
1215
(*import List_extra*)
1316
(*import String*)

semantics/readmePrefix

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The definition of the CakeML language. The definition is (mostly)
2+
expressed in Lem (http://www.cs.kent.ac.uk/~sao/lem), but the
3+
generated HOL is also included. The directory includes definitions of:
4+
- the concrete syntax
5+
- the abstract syntax
6+
- small step semantics
7+
- big step semantics (both functional and relational)
8+
- semantics of FFI calls
9+
- a type system

translator/readmePrefix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A proof-producing translator from HOL functions to CakeML.

unverified/readmePrefix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Various unverified tools, e.g. tools for converting OCaml to CakeML
2+
and an SML version of the CakeML register allocator.

0 commit comments

Comments
 (0)