This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
Build and run a source file that requires a menhir parser.
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 1.0)
|
||||
> (using menhir 1.0)
|
||||
> EOF
|
||||
|
||||
$ dune build ./src/test.exe --debug-dependency-path
|
||||
$ ls _build/default/src/test.exe
|
||||
_build/default/src/test.exe
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 2.0)
|
||||
> (using menhir 2.0)
|
||||
> EOF
|
||||
|
||||
$ dune build ./src/test.exe --debug-dependency-path
|
||||
$ ls _build/default/src/test.exe
|
||||
_build/default/src/test.exe
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
(ocamllex lexer1 lexer2)
|
||||
|
||||
(menhir
|
||||
(modules test_menhir1)
|
||||
(flags :standard --unused-tokens))
|
||||
|
||||
(menhir
|
||||
(merge_into test_base)
|
||||
(flags --explain)
|
||||
(modules tokens parser))
|
||||
|
||||
(executables
|
||||
(names test))
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
open Test_menhir1
|
||||
}
|
||||
|
||||
rule lex = parse
|
||||
| 'c' { TOKEN 'c' }
|
||||
| eof { EOF }
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
open Test_base
|
||||
}
|
||||
|
||||
rule lex = parse
|
||||
| 'c' { TOKEN 'c' }
|
||||
| eof { EOF }
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
%start <char list> main
|
||||
|
||||
%%
|
||||
|
||||
main:
|
||||
| c = TOKEN EOF { [c] }
|
||||
| c = TOKEN xs = main { c :: xs }
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
let s = "foo bar baz"
|
||||
|
||||
let () =
|
||||
let lex1 = Lexing.from_string s in
|
||||
let lex2 = Lexing.from_string s in
|
||||
ignore (Test_menhir1.main Lexer1.lex lex1);
|
||||
ignore (Test_base.main Lexer2.lex lex2)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
%token <char> TOKEN
|
||||
%token EOF
|
||||
|
||||
%start <char list> main
|
||||
|
||||
%%
|
||||
|
||||
main:
|
||||
| c = TOKEN EOF { [c] }
|
||||
| c = TOKEN xs = main { c :: xs }
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
%token <char> TOKEN
|
||||
%token EOF
|
||||
|
||||
%%
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue