Skip to content

Commit

Permalink
Update manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Evans committed Aug 25, 2024
1 parent fc08cf3 commit ec9df1d
Show file tree
Hide file tree
Showing 5 changed files with 335 additions and 264 deletions.
26 changes: 3 additions & 23 deletions bootstrap/bin/hocc/Parse.hmh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ type nonterm_precs_tl =
| Hmhi of {prelude: nonterm_matter; hocc_: token_hocc; postlude: nonterm_matter; eoi: token_eoi}

include hocc
neutral pCodeTl

(* hocc-specific keywords *)
token HOCC "hocc" of token_hocc
token NONTERM "nonterm" of token_nonterm
Expand All @@ -294,7 +296,6 @@ include hocc
token ISTRING of token_istring

(* Punctuation/separators *)
neutral pCodeTl
token COLON_COLON_EQ "::=" of token_colon_colon_eq
token OF "of" of token_of
token COLON ":" of token_colon
Expand Down Expand Up @@ -731,37 +732,16 @@ let hmhi scanner =
let hmh scanner =
let rec inner scanner errs parser = begin
let scanner, scan_token, token, mals = scan scanner in
(*
File.Fmt.stderr
|> Fmt.fmt "XXX scan_token="
|> Scan.Token.pp scan_token
|> Fmt.fmt "\n"
|> ignore;
*)
let errs = match mals with
| [] -> errs
| _ -> List.fold ~init:errs ~f:(fun errs mal -> Error.init_mal mal :: errs) mals
in
let {stack=_XXX; status} as parser = next token parser in
(*
File.Fmt.stderr
|> Fmt.fmt "XXX status="
|> Status.pp status
|> Fmt.fmt "\n"
|> ignore;
*)
let {status; _} as parser = next token parser in
match status, errs with
| Prefix, _ -> inner scanner errs parser
| Accept (Hmh hmh), [] -> scanner, Ok hmh
| Accept (Hmh _), _ -> scanner, Error errs
| Reject _, _ -> begin
(*
File.Fmt.stderr
|> Fmt.fmt "XXX stack="
|> Stack.fmt ~alt:true stack
|> Fmt.fmt "\n"
|> ignore;
*)
let errs = Error.init_token scan_token "Unexpected token" :: errs in
scanner, Error errs
end
Expand Down
Loading

0 comments on commit ec9df1d

Please sign in to comment.