Commit 631c4357 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Using zen Aum to control entry

parent 4efc4058
......@@ -26,22 +26,24 @@ include ../Makefile.master
###############################
# Used libraries
LIBS += dyp.cma str.cma
LIBS += dyp.cma str.cma zen.cma
# The corresponding directories
# (if not in the main ocaml lib directory,
# ex. -I +campl4
LIBDIR = @DYPGEN_INCLUDE@ -I +camlp4
LIBDIR += @DYPGEN_INCLUDE@
# Directories to which the current source files depend on
PREVIOUS_DIRS = ../utils ../logic
# Source files in the right order of dependance
#ML = error.ml abstract_syntax.ml interface.ml environment.ml entry.ml parser.ml lexer.ml data_parsing.ml
ML = error.ml interface.ml environment.ml entry.ml syntactic_data_structures.ml acg_token.ml lexer.ml parser.ml interactive.ml
#ML = error.ml abstract_syntax.ml interface.ml environment.ml entry.ml data_parser.ml data_lexer.ml data_parsing.ml
ML = error.ml interface.ml environment.ml entry.ml syntactic_data_structures.ml acg_token.ml data_lexer.ml data_parser.ml interactive.ml
DYP = parser.dyp
CAMLLEX = lexer.mll
EXE_SOURCES = essai_sylvain.ml
DYP = data_parser.dyp
CAMLLEX = data_lexer.mll
####################################
......@@ -57,23 +59,43 @@ include ../Makefile.common
# DYPGEN_EXE = @DYPGEN@ --no-pp --no-obj-type --ocamlc "$(LIBDIR) $(I_PREVIOUS_DIRS)"
# parser.ml : parser.dyp
# data_parser.ml : data_parser.dyp
# $(DYPGEN_EXE) --noemit-token-type $<
# #parser.ml : parser.dyp
# #data_parser.ml : data_parser.dyp
# # $(DYPGEN_EXE) --noemit-token-type $<
# lexer.ml : lexer.mll
# data_lexer.ml : data_lexer.mll
# @OCAMLLEX@ $<
parser.ml: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
lexer.cmi error.cmi environment.cmi entry.cmi \
data_parser.ml: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
data_lexer.cmi error.cmi environment.cmi entry.cmi \
../logic/abstract_syntax.cmi
parser.cmo: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
lexer.cmo error.cmi environment.cmi entry.cmi \
../logic/abstract_syntax.cmi parser.cmi
parser.cmx: ../utils/utils.cmx acg_token.cmx syntactic_data_structures.cmx \
lexer.cmx error.cmx environment.cmx entry.cmx \
../logic/abstract_syntax.cmx parser.cmi
parser.ml: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
data_parser.cmo: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
data_lexer.cmo error.cmi environment.cmi entry.cmi \
../logic/abstract_syntax.cmi data_parser.cmi
data_parser.cmx: ../utils/utils.cmx acg_token.cmx syntactic_data_structures.cmx \
data_lexer.cmx error.cmx environment.cmx entry.cmx \
../logic/abstract_syntax.cmx data_parser.cmi
data_parser.ml: ../utils/utils.cmi acg_token.cmi syntactic_data_structures.cmi \
example_dispatch.ml : example.aut
@OCAMLP4@ -I /usr/local/lib/ocaml/zen pr_r.cmo regular.cmo make_dispatch.cmo < $< > $@
essai_sylvain.cmo : example_dispatch.cmo
essai_sylvain.cmx : example_dispatch.cmx
essai_sylvain : $(filter-out essai_sylvain.cmo,$(CMO)) example_dispatch.cmo essai_sylvain.cmo
@OCAMLC@ -o $@ $(LIBDIR) $(LIBS) $(BYTEFLAGS) $^
essai_sylvain.opt : $(filter-out essai_sylvain.cmx,$(CMX)) example_dispatch.cmx essai_sylvain.cmx
@OCAMLCOPT@ -o $@ $(LIBDIR) $(LIBSOPT) $(OPTFLAGS) $^
truc : $(filter-out essai_sylvain.cmo,$(CMO)) example_dispatch.cmo essai_sylvain.cmo
echo $^
example_dispatch.cmo : PP=-pp "@OCAMLP4@ pa_r.cmo pa_rp.cmo pr_dump.cmo pa_extend.cmo"
example_dispatch.cmx : PP=-pp "@OCAMLP4@ pa_r.cmo pa_rp.cmo pr_dump.cmo pa_extend.cmo"
\ No newline at end of file
......@@ -509,9 +509,9 @@ sig_entries :
let lexbuf = Lexing.from_channel in_ch in
let actual_env = if env=E.empty then None else Some (Env env) in
let () = Printf.printf "Parsing \"%s\"...\n%!" filename in
let () = Lexer.set_to_data () in
let () = Data_lexer.set_to_data () in
let e =
try (fst (List.hd (data ~global_data:override ~local_data:actual_env Lexer.lexer lexbuf))) with
try (fst (List.hd (data ~global_data:override ~local_data:actual_env Data_lexer.lexer lexbuf))) with
| Dyp.Syntax_error -> raise (Error.dyp_error lexbuf filename) in
let () = Printf.printf "Done.\n%!" in
let () = match output with
......@@ -538,9 +538,9 @@ sig_entries :
let parse_term ?(offset="") ?(output=false) t sg =
let lexbuf = Lexing.from_string t in
try
let () = Lexer.set_to_term () in
let () = Data_lexer.set_to_term () in
let abs_term,abs_type =
try fst (List.hd(term_alone ~global_data:false ~local_data:(Some (Signature sg)) Lexer.lexer lexbuf)) with
try fst (List.hd(term_alone ~global_data:false ~local_data:(Some (Signature sg)) Data_lexer.lexer lexbuf)) with
| Dyp.Syntax_error -> raise (Error.dyp_error lexbuf "stdin") in
let () = match output with
| true -> Printf.printf "%s : %s \n%!" (E.Signature1.term_to_string abs_term sg) (E.Signature1.type_to_string abs_type sg)
......@@ -566,8 +566,8 @@ sig_entries :
let parse_sig_entry ?(offset="") t sg =
let lexbuf = Lexing.from_string t in
try
let () = Lexer.set_to_sig_entry () in
try Some ((fst (List.hd(sig_entry ~global_data:false ~local_data:(Some (Signature sg)) Lexer.lexer lexbuf))) sg) with
let () = Data_lexer.set_to_sig_entry () in
try Some ((fst (List.hd(sig_entry ~global_data:false ~local_data:(Some (Signature sg)) Data_lexer.lexer lexbuf))) sg) with
| Dyp.Syntax_error -> raise (Error.dyp_error lexbuf "stdin")
with
| Error.Error er ->
......@@ -588,8 +588,8 @@ sig_entries :
let parse_lex_entry ?(offset="") t lex =
let lexbuf = Lexing.from_string t in
try
let () = Lexer.set_to_lex_entry () in
try Some ((fst (List.hd(lex_entry ~global_data:false ~local_data:(Some (Abs_and_obj (E.Lexicon.get_sig lex))) Lexer.lexer lexbuf))) lex) with
let () = Data_lexer.set_to_lex_entry () in
try Some ((fst (List.hd(lex_entry ~global_data:false ~local_data:(Some (Abs_and_obj (E.Lexicon.get_sig lex))) Data_lexer.lexer lexbuf))) lex) with
| Dyp.Syntax_error -> raise (Error.dyp_error lexbuf "stdin")
with
| Error.Error er ->
......
(* Exemple automaton description - see syntax in Parser module (regular.ml) *)
initial init epsilon_aum
alphabet a; b; c end
automaton Disp
node A = a* . b . init in
node FINAL = A.c.A
end
......@@ -40,7 +40,7 @@ struct
let env = ref Actual_env.empty
module Actual_parser = Parser.Make(Actual_env)
module Actual_parser = Data_parser.Make(Actual_env)
let parse_term sg =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment