Code Monkey home page Code Monkey logo

nice-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nice-parser's Issues

How to use with dune

Hello, I found this project very helpful as I tried to figure out how to use sedlex.

I think people might benefit from seeing an example in dune, especially since RWO is using it now.

Why the usage of `cppo`?

(Related: #2; is this the described “hack?”)

So, I'm relatively new to OCaml (hence using this project to try and understand parsing in OCaml! 🤣); but I don't understand why CPP-style source-transformation is necessary to reach Menhir's generated “token definitions”:

#include "Tokens.ml"
  [@@deriving show, enumerate]

module Sedlexing = LexBuffer
open LexBuffer
(* ... so on, so forth ... *)

Can't we use some sort of built-in language mechanic to include the symbols from the generated Tokens module into both Lexer.mli and the (eventual) Lexer.ml?

This has been a show-stopper for me; as a newbie, I still really depend on Merlin to understand what's going on and write code — and the CPPO invocation at the top of these files completely breaks Merlin, right now. But if there's no other way to do this … )'=

(It looks like somebody's trying to build support for it, ocaml/merlin#548, but that may be a long way off? I'm kinda an outsider, so I'm not sure. See also: let-def/merlin-extend#7.)

Error: Uninterpreted extension 'sedlex.regexp'

Hi,

i get Error: Uninterpreted extension 'sedlex.regexp' as seen below. menhir is version 20180703.

Any idea how to fix this?

Thanks,
Lacramioara

====

isar:07:06:16:~/ocaml-parsing$ make
time -p jbuilder build @install
ocamlopt src/.ocaml_parsing.objs/ocaml_parsing__Lexer.{cmx,o} (exit 2)
(cd _build/default && /home/eugen/.opam/4.06.0/bin/ocamlopt.opt -w -40 -g -I src/.ocaml_parsing.objs -I /home/eugen/.opam/4.06.0/lib/base -I /home/eugen/.opam/4.06.0/lib/base/caml -I /home/eugen/.opam/4.06.0/lib/base/shadow_stdlib -I /home/eugen/.opam/4.06.0/lib/bytes -I /home/eugen/.opam/4.06.0/lib/gen -I /home/eugen/.opam/4.06.0/lib/menhirLib -I /home/eugen/.opam/4.06.0/lib/ocaml/compiler-libs -I /home/eugen/.opam/4.06.0/lib/ppx_deriving -I /home/eugen/.opam/4.06.0/lib/result -I /home/eugen/.opam/4.06.0/lib/sedlex -I /home/eugen/.opam/4.06.0/lib/sexplib0 -I /home/eugen/.opam/4.06.0/lib/stdio -intf-suffix .ml -no-alias-deps -open Ocaml_parsing -o src/.ocaml_parsing.objs/ocaml_parsing__Lexer.cmx -c -impl src/Lexer.pp.ml)
File "src/Lexer.ml", line 42, characters 15-28:
Error: Uninterpreted extension 'sedlex.regexp'.

Having some trouble building...

Howdy! I'm having some trouble building. Perhaps it is just a question of not having the right packages installed via OPAM.

First of all, the build begins with this:

oasis setup-clean
oasis setup
W: Cannot find source file matching module 'My_Tokens' in library parser.
W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".

Second, at the end, I get this, which seems to be the bad part:

  • /Users/perry/.opam/4.05.0/bin/ocamlfind ocamldep -package sedlex -package ppx_import -package core -package compiler-libs.common -package MenhirLib -package ppx_deriving,ppx_deriving.eq,ppx_deriving.enum,ppx_deriving.show,ppx_jane -modules src/My_Lexer.mli > src/My_Lexer.mli.depends
    File "src/My_Lexer.mli", line 1, characters 58-67:
    Error: Cannot locate deriver enumerate
    Command exited with code 2.
    Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.
    E: Failure("Command ''/Users/perry/.opam/4.05.0/bin/ocamlbuild' src/parser.cma test.byte -use-ocamlfind -use-menhir -cflags -w,@5+8@11@12-40,-short-paths -package ppx_deriving,ppx_deriving.eq,ppx_deriving.enum,ppx_deriving.show,ppx_jane -tag debug -tag tests' terminated with error code 10")
    make[1]: *** [all] Error 1
    make: *** [default] Error 2

Explanation of “ppx_sedlex and ppx_import are incompatible with jbuilder?”

So this section of the jbuild seems to imply that it's temporary:

;; generate lexer -- temporary hack while ppx_sedlex and ppx_import are incompatible with jbuilder!!
(rule
 ((targets (Lexer.sedlex.ml))
  (deps    (Lexer.cppo.sedlex.ml Tokens.ml))
  (action  (run ${bin:cppo} ${<} -n -o ${@}))))
(rule
 ((targets (Lexer.mli))
  (deps    (Lexer.cppo.mli Tokens.ml))
  (action  (run ${bin:cppo} ${<} -n -o ${@}))))
(rule
 ((targets (Lexer.ml))
  (deps    (Lexer.sedlex.ml))
  (action  (run ${ocaml_where}/../sedlex/ppx_sedlex ${<} -o ${@}))))

What part of that is the "temporary hack"; and how, specifically, is dune/jbuilder incompatible with Sedlex? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.