Browse Source

Update README

master
Boris Eng 2 years ago
parent
commit
89b0aceefd
  1. 4
      README.md
  2. 212
      lexer.ml
  3. 666
      parser.ml
  4. 27
      parser.mli

4
README.md

@ -72,7 +72,9 @@ Certains exemples avec l'extension `.stellar` sont déjà prêts à être exécu
### Programmes logiques
Les faits sont des étoiles `[+p(t)]` et les règles d'inférences sont des étoiles `[-p(t1)]`
Les faits sont des étoiles `[+p(t1, ..., tn)]` et les règles d'inférences `P(t11, ..., t1n), ... P(tn1, ..., tnm) => P(u1, ..., uk)` sont des étoiles `[-p(t11, ..., t1n), ..., -p(tn1, ..., tnm), +p(u1, ..., uk)]` où les rayons négatifs sont des entrées (hypothèses) et le rayon positif la sortie (conclusion).
Les requêtes sont des étoiles de la forme `[+q(v1, ..., vl), X1, ..., Xp]``+q(v1, ..., vl)` est l'expression correspondant à la requête et `X1, ..., Xp` sont des variables apparaissant dans la requête et que l'on voudrait voir dans le résultat du calcul des réponses à la requête.
### Construire des automates finis

212
lexer.ml

@ -1,212 +0,0 @@
# 1 "lexer.mll"
open Parser
exception Eof
# 7 "lexer.ml"
let __ocaml_lex_tables = {
Lexing.lex_base =
"\000\000\240\255\241\255\001\000\003\000\243\255\002\000\245\255\
\246\255\247\255\248\255\249\255\250\255\251\255\252\255\253\255\
\078\000\088\000\244\255";
Lexing.lex_backtrk =
"\255\255\255\255\255\255\014\000\013\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\001\000\000\000\255\255";
Lexing.lex_default =
"\255\255\000\000\000\000\255\255\255\255\000\000\255\255\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\255\255\255\255\000\000";
Lexing.lex_trans =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\004\000\002\000\002\000\004\000\003\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\004\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\
\015\000\014\000\000\000\008\000\013\000\007\000\005\000\018\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\017\000\012\000\000\000\011\000\000\000\000\000\
\000\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\010\000\006\000\009\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000";
Lexing.lex_check =
"\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\000\000\000\000\003\000\004\000\000\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\000\000\255\255\255\255\004\000\255\255\255\255\255\255\255\255\
\000\000\000\000\255\255\000\000\000\000\000\000\000\000\006\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\255\255\000\000\255\255\255\255\
\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
\016\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255";
Lexing.lex_base_code =
"";
Lexing.lex_backtrk_code =
"";
Lexing.lex_default_code =
"";
Lexing.lex_trans_code =
"";
Lexing.lex_check_code =
"";
Lexing.lex_code =
"";
}
let rec read lexbuf =
__ocaml_lex_read_rec lexbuf 0
and __ocaml_lex_read_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 12 "lexer.mll"
( VAR (Lexing.lexeme lexbuf) )
# 132 "lexer.ml"
| 1 ->
# 13 "lexer.mll"
( SYM (Lexing.lexeme lexbuf) )
# 137 "lexer.ml"
| 2 ->
# 14 "lexer.mll"
( LEFT_PAR )
# 142 "lexer.ml"
| 3 ->
# 15 "lexer.mll"
( RIGHT_PAR )
# 147 "lexer.ml"
| 4 ->
# 16 "lexer.mll"
( COMMA )
# 152 "lexer.ml"
| 5 ->
# 17 "lexer.mll"
( LEFT_BRACK )
# 157 "lexer.ml"
| 6 ->
# 18 "lexer.mll"
( RIGHT_BRACK )
# 162 "lexer.ml"
| 7 ->
# 19 "lexer.mll"
( LEFT_BRACE )
# 167 "lexer.ml"
| 8 ->
# 20 "lexer.mll"
( RIGHT_BRACE )
# 172 "lexer.ml"
| 9 ->
# 21 "lexer.mll"
( PLUS )
# 177 "lexer.ml"
| 10 ->
# 22 "lexer.mll"
( MINUS )
# 182 "lexer.ml"
| 11 ->
# 23 "lexer.mll"
( VDASH )
# 187 "lexer.ml"
| 12 ->
# 24 "lexer.mll"
( DOT )
# 192 "lexer.ml"
| 13 ->
# 25 "lexer.mll"
( read lexbuf )
# 197 "lexer.ml"
| 14 ->
# 26 "lexer.mll"
( read lexbuf )
# 202 "lexer.ml"
| 15 ->
# 27 "lexer.mll"
( exit 0 )
# 207 "lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_read_rec lexbuf __ocaml_lex_state
;;

666
parser.ml

@ -1,666 +0,0 @@
module MenhirBasics = struct
exception Error
let _eRR =
fun _s ->
raise Error
type token =
| VDASH
| VAR of (
# 5 "parser.mly"
(string)
# 16 "parser.ml"
)
| SYM of (
# 6 "parser.mly"
(string)
# 21 "parser.ml"
)
| RIGHT_PAR
| RIGHT_BRACK
| RIGHT_BRACE
| PLUS
| MINUS
| LEFT_PAR
| LEFT_BRACK
| LEFT_BRACE
| DOT
| COMMA
end
include MenhirBasics
type ('s, 'r) _menhir_state =
| MenhirState00 : ('s, _menhir_box_constc) _menhir_state
(** State 00.
Stack shape : .
Start symbol: constc. *)
| MenhirState01 : (('s, 'r) _menhir_cell1_LEFT_BRACE, 'r) _menhir_state
(** State 01.
Stack shape : LEFT_BRACE.
Start symbol: <undetermined>. *)
| MenhirState02 : (('s, 'r) _menhir_cell1_LEFT_BRACK, 'r) _menhir_state
(** State 02.
Stack shape : LEFT_BRACK.
Start symbol: <undetermined>. *)
| MenhirState10 : (('s, 'r) _menhir_cell1_symc, 'r) _menhir_state
(** State 10.
Stack shape : symc.
Start symbol: <undetermined>. *)
| MenhirState14 : (('s, 'r) _menhir_cell1_rayc, 'r) _menhir_state
(** State 14.
Stack shape : rayc.
Start symbol: <undetermined>. *)
| MenhirState16 : (('s, 'r) _menhir_cell1_rayc, 'r) _menhir_state
(** State 16.
Stack shape : rayc.
Start symbol: <undetermined>. *)
| MenhirState22 : (('s, 'r) _menhir_cell1_starc, 'r) _menhir_state
(** State 22.
Stack shape : starc.
Start symbol: <undetermined>. *)
| MenhirState28 : ('s, _menhir_box_spacec) _menhir_state
(** State 28.
Stack shape : .
Start symbol: spacec. *)
| MenhirState29 : (('s, _menhir_box_spacec) _menhir_cell1_LEFT_BRACE, _menhir_box_spacec) _menhir_state
(** State 29.
Stack shape : LEFT_BRACE.
Start symbol: spacec. *)
| MenhirState34 : (('s, _menhir_box_spacec) _menhir_cell1_constc, _menhir_box_spacec) _menhir_state
(** State 34.
Stack shape : constc.
Start symbol: spacec. *)
and ('s, 'r) _menhir_cell1_constc =
| MenhirCell1_constc of 's * ('s, 'r) _menhir_state * (Stellar.constellation)
and ('s, 'r) _menhir_cell1_rayc =
| MenhirCell1_rayc of 's * ('s, 'r) _menhir_state * (Stellar.StellarRays.term)
and ('s, 'r) _menhir_cell1_starc =
| MenhirCell1_starc of 's * ('s, 'r) _menhir_state * (Stellar.star)
and ('s, 'r) _menhir_cell1_symc =
| MenhirCell1_symc of 's * ('s, 'r) _menhir_state * (Stellar.StellarSig.idfunc)
and ('s, 'r) _menhir_cell1_LEFT_BRACE =
| MenhirCell1_LEFT_BRACE of 's * ('s, 'r) _menhir_state
and ('s, 'r) _menhir_cell1_LEFT_BRACK =
| MenhirCell1_LEFT_BRACK of 's * ('s, 'r) _menhir_state
and _menhir_box_spacec =
| MenhirBox_spacec of (Stellar.constellation * Stellar.constellation) [@@unboxed]
and _menhir_box_constc =
| MenhirBox_constc of (Stellar.constellation) [@@unboxed]
let _menhir_action_02 =
fun xs ->
let cs =
# 229 "<standard.mly>"
( xs )
# 119 "parser.ml"
in
(
# 22 "parser.mly"
( cs )
# 124 "parser.ml"
: (Stellar.constellation))
let _menhir_action_03 =
fun () ->
(
# 139 "<standard.mly>"
( [] )
# 132 "parser.ml"
: (Stellar.star))
let _menhir_action_04 =
fun x ->
(
# 141 "<standard.mly>"
( x )
# 140 "parser.ml"
: (Stellar.star))
let _menhir_action_05 =
fun () ->
(
# 139 "<standard.mly>"
( [] )
# 148 "parser.ml"
: (Stellar.constellation))
let _menhir_action_06 =
fun x ->
(
# 141 "<standard.mly>"
( x )
# 156 "parser.ml"
: (Stellar.constellation))
let _menhir_action_07 =
fun x ->
(
# 33 "parser.mly"
( Stellar.to_var x )
# 164 "parser.ml"
: (Stellar.StellarRays.term))
let _menhir_action_08 =
fun r1 r2 ->
(
# 34 "parser.mly"
( Stellar.to_func ((Stellar.Null, "."), [r1; r2]) )
# 172 "parser.ml"
: (Stellar.StellarRays.term))
let _menhir_action_09 =
fun pf ts ->
(
# 36 "parser.mly"
( Stellar.to_func (pf, ts) )
# 180 "parser.ml"
: (Stellar.StellarRays.term))
let _menhir_action_10 =
fun pf ->
(
# 37 "parser.mly"
( Stellar.to_func (pf, []) )
# 188 "parser.ml"
: (Stellar.StellarRays.term))
let _menhir_action_11 =
fun x ->
(
# 238 "<standard.mly>"
( [ x ] )
# 196 "parser.ml"
: (Stellar.star))
let _menhir_action_12 =
fun x xs ->
(
# 240 "<standard.mly>"
( x :: xs )
# 204 "parser.ml"
: (Stellar.star))
let _menhir_action_13 =
fun x ->
(
# 238 "<standard.mly>"
( [ x ] )
# 212 "parser.ml"
: (Stellar.constellation))
let _menhir_action_14 =
fun x xs ->
(
# 240 "<standard.mly>"
( x :: xs )
# 220 "parser.ml"
: (Stellar.constellation))
let _menhir_action_15 =
fun cs space ->
(
# 19 "parser.mly"
( (cs, space) )
# 228 "parser.ml"
: (Stellar.constellation * Stellar.constellation))
let _menhir_action_16 =
fun xs ->
let rs =
# 229 "<standard.mly>"
( xs )
# 236 "parser.ml"
in
(
# 25 "parser.mly"
( rs )
# 241 "parser.ml"
: (Stellar.star))
let _menhir_action_17 =
fun f p ->
(
# 28 "parser.mly"
( (Pos, f) )
# 249 "parser.ml"
: (Stellar.StellarSig.idfunc))
let _menhir_action_18 =
fun f p ->
(
# 29 "parser.mly"
( (Neg, f) )
# 257 "parser.ml"
: (Stellar.StellarSig.idfunc))
let _menhir_action_19 =
fun f ->
(
# 30 "parser.mly"
( (Stellar.Null, f) )
# 265 "parser.ml"
: (Stellar.StellarSig.idfunc))
let _menhir_print_token : token -> string =
fun _tok ->
match _tok with
| COMMA ->
"COMMA"
| DOT ->
"DOT"
| LEFT_BRACE ->
"LEFT_BRACE"
| LEFT_BRACK ->
"LEFT_BRACK"
| LEFT_PAR ->
"LEFT_PAR"
| MINUS ->
"MINUS"
| PLUS ->
"PLUS"
| RIGHT_BRACE ->
"RIGHT_BRACE"
| RIGHT_BRACK ->
"RIGHT_BRACK"
| RIGHT_PAR ->
"RIGHT_PAR"
| SYM _ ->
"SYM"
| VAR _ ->
"VAR"
| VDASH ->
"VDASH"
let _menhir_fail : unit -> 'a =
fun () ->
Printf.eprintf "Internal failure -- please contact the parser generator's developers.\n%!";
assert false
include struct
[@@@ocaml.warning "-4-37-39"]
let rec _menhir_run_35 : type ttv_stack. (ttv_stack, _menhir_box_spacec) _menhir_cell1_constc -> _ -> _menhir_box_spacec =
fun _menhir_stack _v ->
let MenhirCell1_constc (_menhir_stack, _, cs) = _menhir_stack in
let space = _v in
let _v = _menhir_action_15 cs space in
MenhirBox_spacec _v
let rec _menhir_run_27 : type ttv_stack. ttv_stack -> _ -> _menhir_box_constc =
fun _menhir_stack _v ->
MenhirBox_constc _v
let rec _menhir_run_01 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
let _menhir_stack = MenhirCell1_LEFT_BRACE (_menhir_stack, _menhir_s) in
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| LEFT_BRACK ->
_menhir_run_02 _menhir_stack _menhir_lexbuf _menhir_lexer MenhirState01
| RIGHT_BRACE ->
let _v = _menhir_action_05 () in
_menhir_run_25 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| _ ->
_eRR ()
and _menhir_run_02 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
let _menhir_stack = MenhirCell1_LEFT_BRACK (_menhir_stack, _menhir_s) in
let _menhir_s = MenhirState02 in
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| VAR _v ->
_menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| SYM _v ->
_menhir_run_04 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| PLUS ->
_menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| MINUS ->
_menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| RIGHT_BRACK ->
let _v = _menhir_action_03 () in
_menhir_goto_loption_separated_nonempty_list_COMMA_rayc__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| _ ->
_eRR ()
and _menhir_run_03 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
let _tok = _menhir_lexer _menhir_lexbuf in
let x = _v in
let _v = _menhir_action_07 x in
_menhir_goto_rayc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_goto_rayc : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match _menhir_s with
| MenhirState14 ->
_menhir_run_15 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState02 ->
_menhir_run_13 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState16 ->
_menhir_run_13 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState10 ->
_menhir_run_13 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_menhir_fail ()
and _menhir_run_15 : type ttv_stack ttv_result. ((ttv_stack, ttv_result) _menhir_cell1_rayc as 'stack) -> _ -> _ -> _ -> ('stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match (_tok : MenhirBasics.token) with
| DOT ->
let _menhir_stack = MenhirCell1_rayc (_menhir_stack, _menhir_s, _v) in
_menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer
| COMMA | RIGHT_BRACK | RIGHT_PAR ->
let MenhirCell1_rayc (_menhir_stack, _menhir_s, r1) = _menhir_stack in
let r2 = _v in
let _v = _menhir_action_08 r1 r2 in
_menhir_goto_rayc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
and _menhir_run_14 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_rayc -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
let _menhir_s = MenhirState14 in
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| VAR _v ->
_menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| SYM _v ->
_menhir_run_04 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| PLUS ->
_menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| MINUS ->
_menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ()
and _menhir_run_04 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
let _tok = _menhir_lexer _menhir_lexbuf in
let f = _v in
let _v = _menhir_action_19 f in
_menhir_goto_symc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_goto_symc : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match (_tok : MenhirBasics.token) with
| LEFT_PAR ->
let _menhir_stack = MenhirCell1_symc (_menhir_stack, _menhir_s, _v) in
let _menhir_s = MenhirState10 in
let _tok = _menhir_lexer _menhir_lexbuf in
(match (_tok : MenhirBasics.token) with
| VAR _v ->
_menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| SYM _v ->
_menhir_run_04 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| PLUS ->
_menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| MINUS ->
_menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ())
| COMMA | DOT | RIGHT_BRACK | RIGHT_PAR ->
let pf = _v in
let _v = _menhir_action_10 pf in
_menhir_goto_rayc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
and _menhir_run_05 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| SYM _v ->
let _tok = _menhir_lexer _menhir_lexbuf in
let (f, p) = (_v, ()) in
let _v = _menhir_action_17 f p in
_menhir_goto_symc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
and _menhir_run_07 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| SYM _v ->
let _tok = _menhir_lexer _menhir_lexbuf in
let (f, p) = (_v, ()) in
let _v = _menhir_action_18 f p in
_menhir_goto_symc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
and _menhir_run_13 : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match (_tok : MenhirBasics.token) with
| DOT ->
let _menhir_stack = MenhirCell1_rayc (_menhir_stack, _menhir_s, _v) in
_menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer
| COMMA ->
let _menhir_stack = MenhirCell1_rayc (_menhir_stack, _menhir_s, _v) in
let _menhir_s = MenhirState16 in
let _tok = _menhir_lexer _menhir_lexbuf in
(match (_tok : MenhirBasics.token) with
| VAR _v ->
_menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| SYM _v ->
_menhir_run_04 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
| PLUS ->
_menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| MINUS ->
_menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ())
| RIGHT_BRACK | RIGHT_PAR ->
let x = _v in
let _v = _menhir_action_11 x in
_menhir_goto_separated_nonempty_list_COMMA_rayc_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
and _menhir_goto_separated_nonempty_list_COMMA_rayc_ : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match _menhir_s with
| MenhirState02 ->
_menhir_run_18 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| MenhirState16 ->
_menhir_run_17 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| MenhirState10 ->
_menhir_run_11 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| _ ->
_menhir_fail ()
and _menhir_run_18 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_LEFT_BRACK -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
let x = _v in
let _v = _menhir_action_04 x in
_menhir_goto_loption_separated_nonempty_list_COMMA_rayc__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
and _menhir_goto_loption_separated_nonempty_list_COMMA_rayc__ : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_LEFT_BRACK -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
match (_tok : MenhirBasics.token) with
| RIGHT_BRACK ->
let _tok = _menhir_lexer _menhir_lexbuf in
let MenhirCell1_LEFT_BRACK (_menhir_stack, _menhir_s) = _menhir_stack in
let xs = _v in
let _v = _menhir_action_16 xs in
(match (_tok : MenhirBasics.token) with
| PLUS ->
let _menhir_stack = MenhirCell1_starc (_menhir_stack, _menhir_s, _v) in
let _menhir_s = MenhirState22 in
let _tok = _menhir_lexer _menhir_lexbuf in
(match (_tok : MenhirBasics.token) with
| LEFT_BRACK ->
_menhir_run_02 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ())
| RIGHT_BRACE ->
let x = _v in
let _v = _menhir_action_13 x in
_menhir_goto_separated_nonempty_list_PLUS_starc_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ())
| _ ->
_eRR ()
and _menhir_goto_separated_nonempty_list_PLUS_starc_ : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match _menhir_s with
| MenhirState29 ->
_menhir_run_24 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState01 ->
_menhir_run_24 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState22 ->
_menhir_run_23 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| _ ->
_menhir_fail ()
and _menhir_run_24 : type ttv_stack ttv_result. ((ttv_stack, ttv_result) _menhir_cell1_LEFT_BRACE as 'stack) -> _ -> _ -> _ -> ('stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
let x = _v in
let _v = _menhir_action_06 x in
_menhir_goto_loption_separated_nonempty_list_PLUS_starc__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_goto_loption_separated_nonempty_list_PLUS_starc__ : type ttv_stack ttv_result. ((ttv_stack, ttv_result) _menhir_cell1_LEFT_BRACE as 'stack) -> _ -> _ -> _ -> ('stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match _menhir_s with
| MenhirState29 ->
_menhir_run_30 _menhir_stack _menhir_lexbuf _menhir_lexer _v
| MenhirState01 ->
_menhir_run_25 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
| _ ->
_menhir_fail ()
and _menhir_run_30 : type ttv_stack. (ttv_stack, _menhir_box_spacec) _menhir_cell1_LEFT_BRACE -> _ -> _ -> _ -> _menhir_box_spacec =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v ->
let _tok = _menhir_lexer _menhir_lexbuf in
let MenhirCell1_LEFT_BRACE (_menhir_stack, _menhir_s) = _menhir_stack in
let xs = _v in
let _v = _menhir_action_02 xs in
_menhir_goto_constc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_goto_constc : type ttv_stack ttv_result. ttv_stack -> _ -> _ -> _ -> (ttv_stack, ttv_result) _menhir_state -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
match _menhir_s with
| MenhirState34 ->
_menhir_run_35 _menhir_stack _v
| MenhirState28 ->
_menhir_run_33 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| MenhirState00 ->
_menhir_run_27 _menhir_stack _v
| _ ->
_menhir_fail ()
and _menhir_run_33 : type ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_spacec) _menhir_state -> _ -> _menhir_box_spacec =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
let _menhir_stack = MenhirCell1_constc (_menhir_stack, _menhir_s, _v) in
match (_tok : MenhirBasics.token) with
| VDASH ->
let _menhir_s = MenhirState34 in
let _tok = _menhir_lexer _menhir_lexbuf in
(match (_tok : MenhirBasics.token) with
| LEFT_BRACE ->
_menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ())
| _ ->
_eRR ()
and _menhir_run_25 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_LEFT_BRACE -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
let MenhirCell1_LEFT_BRACE (_menhir_stack, _menhir_s) = _menhir_stack in
let xs = _v in
let _v = _menhir_action_02 xs in
_menhir_goto_constc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_run_23 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_starc -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
let MenhirCell1_starc (_menhir_stack, _menhir_s, x) = _menhir_stack in
let xs = _v in
let _v = _menhir_action_14 x xs in
_menhir_goto_separated_nonempty_list_PLUS_starc_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_run_17 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_rayc -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
let MenhirCell1_rayc (_menhir_stack, _menhir_s, x) = _menhir_stack in
let xs = _v in
let _v = _menhir_action_12 x xs in
_menhir_goto_separated_nonempty_list_COMMA_rayc_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
and _menhir_run_11 : type ttv_stack ttv_result. (ttv_stack, ttv_result) _menhir_cell1_symc -> _ -> _ -> _ -> _ -> ttv_result =
fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
match (_tok : MenhirBasics.token) with
| RIGHT_PAR ->
let _tok = _menhir_lexer _menhir_lexbuf in
let MenhirCell1_symc (_menhir_stack, _menhir_s, pf) = _menhir_stack in
let ts = _v in
let _v = _menhir_action_09 pf ts in
_menhir_goto_rayc _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
| _ ->
_eRR ()
let rec _menhir_run_00 : type ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_constc =
fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
let _menhir_s = MenhirState00 in
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| LEFT_BRACE ->
_menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
| _ ->
_eRR ()
let rec _menhir_run_28 : type ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_spacec =
fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
let _tok = _menhir_lexer _menhir_lexbuf in
match (_tok : MenhirBasics.token) with
| LEFT_BRACE ->
let _menhir_stack = MenhirCell1_LEFT_BRACE (_menhir_stack, MenhirState28) in
let _tok = _menhir_lexer _menhir_lexbuf in
(match (_tok : MenhirBasics.token) with
| LEFT_BRACK ->
_menhir_run_02 _menhir_stack _menhir_lexbuf _menhir_lexer MenhirState29
| RIGHT_BRACE ->
let _v = _menhir_action_05 () in
_menhir_run_30 _menhir_stack _menhir_lexbuf _menhir_lexer _v
| _ ->
_eRR ())
| _ ->
_eRR ()
end
let spacec =
fun _menhir_lexer _menhir_lexbuf ->
let _menhir_stack = () in
let MenhirBox_spacec v = _menhir_run_28 _menhir_stack _menhir_lexbuf _menhir_lexer in
v
let constc =
fun _menhir_lexer _menhir_lexbuf ->
let _menhir_stack = () in
let MenhirBox_constc v = _menhir_run_00 _menhir_stack _menhir_lexbuf _menhir_lexer in
v

27
parser.mli

@ -1,27 +0,0 @@
(* The type of tokens. *)
type token =
| VDASH
| VAR of (string)
| SYM of (string)
| RIGHT_PAR
| RIGHT_BRACK
| RIGHT_BRACE
| PLUS
| MINUS
| LEFT_PAR
| LEFT_BRACK
| LEFT_BRACE
| DOT
| COMMA
(* This exception is raised by the monolithic API functions. *)
exception Error
(* The monolithic API. *)
val spacec: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Stellar.constellation * Stellar.constellation)
val constc: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Stellar.constellation)
Loading…
Cancel
Save