package p5scm

  1. Overview
  2. Docs
Scheme via camlp5

Install

Dune Dependency

Authors

Maintainers

Sources

0.3.1.tar.gz
md5=9c7351531eb896d4b8fb49f5f76ccc90
sha512=e515523be854b5fa41e66357ef20282458a90240f29eb0e6075f55bbd6d4dbb24d91cb09d3389f77ac00530408825d7aef46c1133e1a35fce69113464c050eed

doc/src/p5scm.lib/parse.ml.html

Source file parse.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(*
 The MIT License                                                                              

 Copyright (c) 2021 Jason D. Nielsen <drjdnielsen@gmail.com>
 *)

open Lexer_utils

let parse_with_error lexbuf =
  try Parser.prog Lexer.tok lexbuf with
  | Parser.Error -> failwith (pspos lexbuf)

let parse_from_chan chan =
  let lexbuf = Lexing.from_channel chan in
  parse_with_error lexbuf

let parse_from_string str =
  let lexbuf = Lexing.from_string str in
  parse_with_error lexbuf

let parse_to_tp lexbuf =
  let ast = parse_with_error lexbuf in
  let p5str = Pp_ast.ast_to_p5scm ast in
  Trans.scm_to_tp p5str

let parse_to_tp_lst lexbuf =
  let ast = parse_with_error lexbuf in
  let p5str = Pp_ast.ast_to_p5scm ast in
  Trans.scm_to_tp_lst p5str

let parse_to_bin chan =
  let lexbuf = Lexing.from_channel chan in
  let ast = parse_with_error lexbuf in
  let p5str = Pp_ast.ast_to_p5scm ast in  
  Trans.scm_to_bin p5str

let parse_to_file chan =
  let lexbuf = Lexing.from_channel chan in
  let ast = parse_with_error lexbuf in
  let p5str = Pp_ast.ast_to_p5scm ast in  
  Trans.scm_to_bin_file p5str (Filename.temp_file ~temp_dir:"./" "test" ".ml")
OCaml

Innovation. Community. Security.