package p5scm

  1. Overview
  2. Docs
Scheme via camlp5

Install

Dune Dependency

Authors

Maintainers

Sources

0.4.0.tar.gz
md5=eb4ee666fd862f7c8057cca4a73daf44
sha512=d28ee892b8fc3241c42f531f9d372b1b007abbef128c3f3862fa5ad943a3eae1d655b34daac19940e1f9fad1ecfca1419a89c7507b6cbd40d9c0490c6aa6761e

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.