this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Initial commit

Jon Sterling e70adbb2

+186
+2
.gitignore
··· 1 + _build 2 +
+11
.ocamlformat
··· 1 + version=0.29.0 2 + profile=conventional 3 + 4 + exp-grouping=preserve 5 + cases-exp-indent=2 6 + space-around-records=false 7 + space-around-lists=false 8 + space-around-variants=false 9 + space-around-arrays=false 10 + field-space=tight-decl 11 + module-item-spacing=preserve
+4
bin/dune
··· 1 + (executable 2 + (public_name concrete-syntax) 3 + (name main) 4 + (libraries concrete_syntax))
+1
bin/main.ml
··· 1 + let () = print_endline "Hello, World!"
+32
concrete-syntax.opam
··· 1 + # This file is generated by dune, edit dune-project instead 2 + opam-version: "2.0" 3 + synopsis: "A short synopsis" 4 + description: "A longer description" 5 + maintainer: ["Maintainer Name <maintainer@example.com>"] 6 + authors: ["Author Name <author@example.com>"] 7 + license: "LICENSE" 8 + tags: ["add topics" "to describe" "your" "project"] 9 + homepage: "https://github.com/username/reponame" 10 + doc: "https://url/to/documentation" 11 + bug-reports: "https://github.com/username/reponame/issues" 12 + depends: [ 13 + "dune" {>= "3.22"} 14 + "ocaml" 15 + "odoc" {with-doc} 16 + ] 17 + build: [ 18 + ["dune" "subst"] {dev} 19 + [ 20 + "dune" 21 + "build" 22 + "-p" 23 + name 24 + "-j" 25 + jobs 26 + "@install" 27 + "@runtest" {with-test} 28 + "@doc" {with-doc} 29 + ] 30 + ] 31 + dev-repo: "git+https://github.com/username/reponame.git" 32 + x-maintenance-intent: ["(latest)"]
+26
dune-project
··· 1 + (lang dune 3.22) 2 + 3 + (name concrete-syntax) 4 + 5 + (generate_opam_files true) 6 + 7 + (source 8 + (github username/reponame)) 9 + 10 + (authors "Author Name <author@example.com>") 11 + 12 + (maintainers "Maintainer Name <maintainer@example.com>") 13 + 14 + (license LICENSE) 15 + 16 + (documentation https://url/to/documentation) 17 + 18 + (package 19 + (name concrete-syntax) 20 + (synopsis "A short synopsis") 21 + (description "A longer description") 22 + (depends ocaml) 23 + (tags 24 + ("add topics" "to describe" your project))) 25 + 26 + ; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
+31
lib/Algebra.ml
··· 1 + module type Monoid = sig 2 + type t 3 + val empty : t 4 + val append : t -> t -> t 5 + end 6 + 7 + module type MonoidHom = sig 8 + module S : Monoid 9 + module T : Monoid 10 + val hom : S.t -> T.t 11 + end 12 + 13 + module String_monoid : Monoid with type t = string = struct 14 + type t = string 15 + let empty = "" 16 + let append = ( ^ ) 17 + end 18 + 19 + module Int_additive_monoid : Monoid with type t = int = struct 20 + type t = int 21 + let empty = 0 22 + let append = ( + ) 23 + end 24 + 25 + module String_length_hom : 26 + MonoidHom with module S = String_monoid and module T = Int_additive_monoid = 27 + struct 28 + module S = String_monoid 29 + module T = Int_additive_monoid 30 + let hom = String.length 31 + end
+74
lib/Concrete_syntax.ml
··· 1 + open Algebra 2 + 3 + module type S = sig 4 + type content 5 + type offset 6 + type token_info 7 + type node_info 8 + 9 + type token = {info: token_info; content: content} 10 + type 'a node = {info: node_info; children: 'a list} 11 + type 'a layer = Token of token | Node of 'a node 12 + type tree = Tree of tree layer 13 + 14 + type cursor = {offset: offset; layer: cursor layer} 15 + 16 + val localise_tree : offset:offset -> tree -> cursor * offset 17 + val tree_content : tree -> content 18 + end 19 + 20 + module type Input = sig 21 + module Content : MonoidHom 22 + type token_info 23 + type node_info 24 + end 25 + 26 + module Make (I : Input) : S = struct 27 + type content = I.Content.S.t 28 + type offset = I.Content.T.t 29 + type token_info = I.token_info 30 + type node_info = I.node_info 31 + 32 + type token = {info: token_info; content: content} 33 + type 'a node = {info: node_info; children: 'a list} 34 + type 'a layer = Token of token | Node of 'a node 35 + type tree = Tree of tree layer 36 + 37 + type cursor = {offset: offset; layer: cursor layer} 38 + 39 + let rec localise_tree ~offset (Tree layer) : cursor * offset = 40 + let layer, new_offset = localise_layer ~offset layer in 41 + ({offset; layer}, new_offset) 42 + 43 + and localise_children ~offset : tree list -> cursor list * offset = function 44 + | [] -> ([], offset) 45 + | child :: children -> 46 + let head_cursor, offset = localise_tree ~offset child in 47 + let tail_cursors, offset = localise_children ~offset children in 48 + (head_cursor :: tail_cursors, offset) 49 + 50 + and localise_node ~offset (node : tree node) : cursor node * offset = 51 + let children, offset = localise_children ~offset node.children in 52 + ({node with children}, offset) 53 + 54 + and localise_layer ~offset : tree layer -> cursor layer * offset = function 55 + | Token tok -> 56 + (Token tok, I.Content.T.append offset (I.Content.hom tok.content)) 57 + | Node node -> 58 + let node, offset = localise_node ~offset node in 59 + (Node node, offset) 60 + 61 + let rec tree_content (Tree layer) = tree_layer_content layer 62 + 63 + and tree_layer_content : tree layer -> content = function 64 + | Token tok -> tok.content 65 + | Node node -> 66 + List.fold_left 67 + (fun acc tree -> I.Content.S.append acc (tree_content tree)) 68 + I.Content.S.empty node.children 69 + 70 + and tree_node_content (node : tree node) : content = 71 + List.fold_left 72 + (fun acc tree -> I.Content.S.append acc (tree_content tree)) 73 + I.Content.S.empty node.children 74 + end
+2
lib/dune
··· 1 + (library 2 + (name concrete_syntax))
+3
test/dune
··· 1 + (test 2 + (name test_concrete_syntax) 3 + (libraries concrete_syntax))
test/test_concrete_syntax.ml

This is a binary file and will not be displayed.