Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ACGtk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ACG
dev
ACGtk
Commits
1b5e6d87
Commit
1b5e6d87
authored
Oct 22, 2008
by
POGODALLA Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modification after dypgen upgrade to
parent
6e8fac1e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
55 deletions
+65
-55
INSTALL
INSTALL
+10
-0
config/configure.ac
config/configure.ac
+1
-1
configure
configure
+1
-1
src/grammars/parser.dyp
src/grammars/parser.dyp
+31
-31
src/scripting/script_parser.dyp
src/scripting/script_parser.dyp
+22
-22
No files found.
INSTALL
View file @
1b5e6d87
...
...
@@ -17,6 +17,16 @@
* *
**************************************************************************
*****************
* Prerequisites *
*****************
In order to compile the ACG toolkit, you need:
+ ocaml (>=3.07) installed (http://caml.inria.fr/)
+ dypgen (>=20080925) installed (http://dypgen.free.fr/)
To install the ACG toolkit, first run:
./configure
...
...
config/configure.ac
View file @
1b5e6d87
...
...
@@ -69,7 +69,7 @@ if test "$OCAMLLEX" = no ; then
fi
#Look for dypgen
DYPGEN_NEEDED=20080
702
DYPGEN_NEEDED=20080
925
AC_CHECK_PROGS(DYPGEN,dypgen.opt dypgen,no)
if test "$DYPGEN" = no ; then
AC_MSG_ERROR(Cannot find dypgen)
...
...
configure
View file @
1b5e6d87
...
...
@@ -1978,7 +1978,7 @@ echo "$as_me: error: Cannot find ocamllex" >&2;}
fi
#Look for dypgen
DYPGEN_NEEDED
=
20080
702
DYPGEN_NEEDED
=
20080
925
for
ac_prog
in
dypgen.opt dypgen
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
...
...
src/grammars/parser.dyp
View file @
1b5e6d87
...
...
@@ -178,23 +178,23 @@
data:
| EOI {get_env_value dyp.last_local_data}
| signature
[s] ...@{s,[Local_data (Some (Env (E.insert ~override:dyp.global_data (E.Signature s) (get_env_value dyp.last_local_data))))]} data[d]
{d}
| lexicon
[l] ...@{let () = E.Lexicon.check l in l,[Local_data (Some (Env (E.insert ~override:dyp.global_data (E.Lexicon l) (get_env_value dyp.last_local_data))))]} data[d]
{d}
| signature
<s> ...@{s,[Local_data (Some (Env (E.insert ~override:dyp.global_data (E.Signature s) (get_env_value dyp.last_local_data))))]} data<d>
{d}
| lexicon
<l> ...@{let () = E.Lexicon.check l in l,[Local_data (Some (Env (E.insert ~override:dyp.global_data (E.Lexicon l) (get_env_value dyp.last_local_data))))]} data<d>
{d}
signature :
| SIG_OPEN sig_ident EQUAL sig_entries {$4}
| SIG_OPEN sig_ident EQUAL sig_entries {$4}
sig_ident :
| IDENT
[n]
@{n,[Local_data (Some (Signature (E.Signature1.empty n)))]}
| IDENT
<n>
@{n,[Local_data (Some (Signature (E.Signature1.empty n)))]}
lexicon :
| LEX_OPEN lex_opening
[l] EQUAL lex_entries[e]
{e l}
| LEX_OPEN lex_opening
[l] EQUAL lex_entries[e]
{e l}
| LEX_OPEN lex_opening
<l> EQUAL lex_entries<e>
{e l}
| LEX_OPEN lex_opening
<l> EQUAL lex_entries<e>
{e l}
lex_opening :
| IDENT
[name] LPAREN IDENT[abs_name,abs_loc] RPAREN COLON IDENT[obj_name,obj_loc]
@{
| IDENT
<name> LPAREN IDENT<abs_name,abs_loc> RPAREN COLON IDENT<obj_name,obj_loc>
@{
let env = get_env_value dyp.last_local_data in
let abs =
try
...
...
@@ -244,8 +244,8 @@ sig_entries :
new_sig}
comma_ids :
| IDENT
[id]
{[id]}
| IDENT
[id] COMMA comma_ids[id_list]
{id::id_list}
| IDENT
<id>
{[id]}
| IDENT
<id> COMMA comma_ids<id_list>
{id::id_list}
type_definition :
| IDENT EQUAL type_expression COLON TYPE {
...
...
@@ -275,7 +275,7 @@ sig_entries :
type_expression :
| atomic_type {$1} atom_type
| atomic_type (<= atom_type) arrow
[a]
type_expression (<=arrow_type) {fun sg ->
| atomic_type (<= atom_type) arrow
<a>
type_expression (<=arrow_type) {fun sg ->
let ty1,loc1 = $1 sg in
let ty2,loc2 = $3 sg in
let new_loc = new_loc loc1 loc2 in (a (ty1,ty2,new_loc)),new_loc} arrow_type
...
...
@@ -311,14 +311,14 @@ sig_entries :
term_dec_start :
| comma_ids {List.map (fun (id,loc) -> (id,Abstract_syntax.Default,loc)) $1}
| PREFIX SYMBOL
[sym,l]
{[sym,Abstract_syntax.Prefix,l]}
| INFIX SYMBOL
[sym,l]
{[sym,Abstract_syntax.Infix,l]}
| PREFIX SYMBOL
<sym,l>
{[sym,Abstract_syntax.Prefix,l]}
| INFIX SYMBOL
<sym,l>
{[sym,Abstract_syntax.Infix,l]}
| BINDER IDENT {[fst $2,Abstract_syntax.Binder,snd $2]}
term_def_start :
| IDENT {fst $1,Abstract_syntax.Default,snd $1}
| PREFIX SYMBOL
[sym,l]
{(sym,Abstract_syntax.Prefix,l)}
| INFIX SYMBOL
[sym,l]
{(sym,Abstract_syntax.Infix,l)}
| PREFIX SYMBOL
<sym,l>
{(sym,Abstract_syntax.Prefix,l)}
| INFIX SYMBOL
<sym,l>
{(sym,Abstract_syntax.Infix,l)}
| BINDER IDENT {fst $2,Abstract_syntax.Binder,snd $2}
...
...
@@ -337,7 +337,7 @@ sig_entries :
new_sig}
term_alone :
| term
[t] COLON type_expression[ty]
EOI {let sg = (get_sig_value dyp.last_local_data) in
| term
<t> COLON type_expression<ty>
EOI {let sg = (get_sig_value dyp.last_local_data) in
E.Signature1.convert_term (fst (t Env.empty [])) (fst (ty sg)) sg (*(E.Signature1.empty ("fake signature",(Lexing.dummy_pos,Lexing.dummy_pos)))*)}
term :
...
...
@@ -347,25 +347,25 @@ sig_entries :
| LAMBDA idents DOT term {
let sg = get_sig_value dyp.last_local_data in
fun env ws -> reset_location $1 (multiple_abs env ws Abstract_syntax.Non_linear $2 $4 (fun x -> x))} binder
| IDENT
[b] idents[ids]
DOT ...{let sg = get_sig_value dyp.last_local_data in
| IDENT
<b> idents<ids>
DOT ...{let sg = get_sig_value dyp.last_local_data in
let binder,((p1,p2) as l) = b in
match E.Signature1.is_constant binder sg with
| true,Some Abstract_syntax.Binder -> (
match E.Signature1.get_binder_argument_functional_type binder sg with
| None -> failwith "Binder of non functional type"
| Some k -> k)
| _ -> emit_parse_error (Error.Binder_expected binder) (p1,p2) }
[lin]
term
[t]
{
| _ -> emit_parse_error (Error.Binder_expected binder) (p1,p2) }
<lin>
term
<t>
{
let binder,((p1,p2) as l) = b in
fun env ws -> reset_binder_location l (multiple_bind env ws (Abstract_syntax.Const(binder,l)) lin ids t (fun x -> x))} binder
| application(<=app) {$1} app
| atomic_term(<=atom)
[arg1] SYMBOL[sym]
...{let id,((pos1,pos2) as l) = sym in
| atomic_term(<=atom)
<arg1> SYMBOL<sym>
...{let id,((pos1,pos2) as l) = sym in
let sg = get_sig_value dyp.last_local_data in
match E.Signature1.is_constant id sg with
| true,Some (Abstract_syntax.Infix) -> Error.unset_infix ()
| true,_ -> raise Dyp.Giveup
| _ -> emit_parse_error (Error.Unknown_constant id) (pos1,pos2)}
term(<=app)
[arg2]
{let id,((pos1,pos2) as l) = sym in
term(<=app)
<arg2>
{let id,((pos1,pos2) as l) = sym in
(fun env ws->
let u1,ws1 = arg1 env ws in
let u2,ws2 = arg2 env ws1 in
...
...
@@ -382,14 +382,14 @@ sig_entries :
| false,true -> Abstract_syntax.Const (id,l),ws
| false,false ->emit_parse_error (Error.Unknown_constant id) (fst l,snd l)} atom
| LPAREN term RPAREN {$2} atom
| SYMBOL
[sym]
...{let sg = get_sig_value dyp.last_local_data in
| SYMBOL
<sym>
...{let sg = get_sig_value dyp.last_local_data in
let id,((pos1,pos2) as l) = sym in
match E.Signature1.is_constant id sg with
| true,Some (Abstract_syntax.Prefix) -> ()
| true,_ -> let () = Error.set_infix sym in
raise Dyp.Giveup
| _ -> emit_parse_error (Error.Unknown_constant id) (pos1,pos2)}
term
[t]
{let id,((pos1,pos2) as l) = sym in
term
<t>
{let id,((pos1,pos2) as l) = sym in
(fun env ws ->
let u2,ws2 = t env ws in
(Abstract_syntax.App(Abstract_syntax.Const(id,l),u2,new_loc l (get_term_location u2))),ws2)} atom
...
...
@@ -407,12 +407,12 @@ sig_entries :
lex_entries :
| END_OF_DEC {fun lex -> lex}
| lex_entry
[e]
END_OF_DEC {fun lex -> e lex}
| lex_entry
[e] SEMICOLON lex_entries[es]
{fun lex -> es (e lex)}
| lex_entry
<e>
END_OF_DEC {fun lex -> e lex}
| lex_entry
<e> SEMICOLON lex_entries<es>
{fun lex -> es (e lex)}
lex_entry :
| comma_ids_or_sym
[ids]
COLON_EQUAL ...{
| comma_ids_or_sym
<ids>
COLON_EQUAL ...{
let abs,obj = get_abs_and_obj_sig_value dyp.last_local_data in
let kind =
List.fold_left
...
...
@@ -429,14 +429,14 @@ sig_entries :
| Some Type,_ -> failwith "Bug: should not occur")
None
ids in ()}
term
[t]
{
term
<t>
{
fun lex ->
let term = fst (t Env.empty []) in
List.fold_left
(fun acc (id,loc) -> E.Lexicon.insert (Abstract_syntax.Constant (id,loc,term)) acc)
lex
ids}
| comma_ids
[ids]
COLON_EQUAL ...{
| comma_ids
<ids>
COLON_EQUAL ...{
let abs,obj = get_abs_and_obj_sig_value dyp.last_local_data in
let kind =
List.fold_left
...
...
@@ -453,7 +453,7 @@ sig_entries :
| Some Cst,_ -> failwith "Bug: should not occur")
None
ids in ()}
type_expression
[ty]
{
type_expression
<ty>
{
fun lex ->
let _,obj = get_abs_and_obj_sig_value dyp.last_local_data in
let actual_type = fst (ty obj) in
...
...
@@ -463,10 +463,10 @@ sig_entries :
ids}
comma_ids_or_sym :
| IDENT
[id]
{[id]}
| SYMBOL
[id]
{[id]}
| IDENT
[id] COMMA comma_ids[id_list]
{id::id_list}
| SYMBOL
[id] COMMA comma_ids[id_list]
{id::id_list}
| IDENT
<id>
{[id]}
| SYMBOL
<id>
{[id]}
| IDENT
<id> COMMA comma_ids<id_list>
{id::id_list}
| SYMBOL
<id> COMMA comma_ids<id_list>
{id::id_list}
%%
...
...
src/scripting/script_parser.dyp
View file @
1b5e6d87
...
...
@@ -79,7 +79,7 @@
zzcommands :
| EOII @{let e,f = dyp.last_local_data in
(e,[Local_data (e,f)])}
| command
[c]
...@{let e,f = (dyp.last_local_data) in
| command
<c>
...@{let e,f = (dyp.last_local_data) in
let e' =
try
c e
...
...
@@ -91,23 +91,23 @@
command:
| WAIT SEMICOLONN
[l]
@{let g_d1,g_d2,g_d3 = dyp.global_data in
| WAIT SEMICOLONN
<l>
@{let g_d1,g_d2,g_d3 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.wait () in e),[Global_data (true,g_d2,g_d3)]}
| DONT WAIT SEMICOLONN
[l]
@{let g_d1,g_d2,g_d3 = dyp.global_data in
| DONT WAIT SEMICOLONN
<l>
@{let g_d1,g_d2,g_d3 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.dont_wait () in e),[Global_data (false,g_d2,g_d3)]}
| LOAD_DATA
[(s,loc,l)]
{fun e -> let () = echo dyp.global_data l in
| LOAD_DATA
<s,loc,l>
{fun e -> let () = echo dyp.global_data l in
let _,_,incl = dyp.global_data in
F.load F.Data s incl e}
| LOAD_SCRIPT
[(s,loc,l)]
{fun e -> let () = echo dyp.global_data l in
| LOAD_SCRIPT
<s,loc,l>
{fun e -> let () = echo dyp.global_data l in
let _,_,includes = dyp.global_data in
let new_env = F.load (F.Script (snd dyp.last_local_data)) s includes e in
new_env}
| LIST SEMICOLONN
[l]
{fun e -> let () = echo dyp.global_data l in let () = F.list e in e}
| SELECT IDENTT
[(name,loc)] SEMICOLONN[l]
{fun e -> let () = echo dyp.global_data l in F.select name loc e}
| UNSELECT SEMICOLONN
[l]
{ let () = echo dyp.global_data l in F.unselect}
| TRACE SEMICOLONN
[l]
{ let () = echo dyp.global_data l in fun e -> let () = F.trace () in e}
| DONT TRACE SEMICOLONN
[l]
{ let () = echo dyp.global_data l in fun e -> let () = F.dont_trace () in e}
| optional_ident
[name] PRINT[p] SEMICOLONN[l]
{ let () = echo dyp.global_data l in fun e ->
| LIST SEMICOLONN
<l>
{fun e -> let () = echo dyp.global_data l in let () = F.list e in e}
| SELECT IDENTT
<name,loc> SEMICOLONN<l>
{fun e -> let () = echo dyp.global_data l in F.select name loc e}
| UNSELECT SEMICOLONN
<l>
{ let () = echo dyp.global_data l in F.unselect}
| TRACE SEMICOLONN
<l>
{ let () = echo dyp.global_data l in fun e -> let () = F.trace () in e}
| DONT TRACE SEMICOLONN
<l>
{ let () = echo dyp.global_data l in fun e -> let () = F.dont_trace () in e}
| optional_ident
<name> PRINT<p> SEMICOLONN<l>
{ let () = echo dyp.global_data l in fun e ->
let loc =
match name with
| None -> p
...
...
@@ -115,21 +115,21 @@
match name with
| None -> let () = F.print e loc in e
| Some (n,l) -> let () = F.print ~name:n e loc in e}
| optional_idents
[names] ANALYSE[(t,l,line)]
{ let () = echo dyp.global_data line in fun e ->
| optional_idents
<names> ANALYSE<t,l,line>
{ let () = echo dyp.global_data line in fun e ->
match names with
| [] -> let () = F.analyse e t l in e
| _ -> let () = F.analyse ~names e t l in e}
| optional_idents
[names] ADD[(t,l,line)]
{ let () = echo dyp.global_data line in fun e ->
| optional_idents
<names> ADD<t,l,line>
{ let () = echo dyp.global_data line in fun e ->
match names with
| [] -> F.add e t l
| _ -> F.add ~names e t l}
| COMPOSE IDENTT
[n1] IDENTT [n2] AS IDENTT[n3] SEMICOLONN[l]
{ let () = echo dyp.global_data l in fun e -> F.compose n1 n2 n3 e}
| HELP SEMICOLONN
[l]
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help None) in e}
| all_commands
[c] HELP SEMICOLONN[l]
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some c)) in e}
| LOAD_HELP SEMICOLONN
[l]
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Load)) in e}
| CREATE_SIG IDENTT
[n] SEMICOLONN[l]
{let () = echo dyp.global_data l in fun e -> F.create_sig n e}
| CREATE_LEX IDENTT
[n] IDENTT[n1] IDENTT[n2] SEMICOLONN[l]
{let () = echo dyp.global_data l in fun e -> F.create_lex ~abs:n1 ~obj:n2 n e}
| optional_idents
[names] SAVE[(filename,l,line)]
{ let () = echo dyp.global_data line in fun e ->
| COMPOSE IDENTT
<n1> IDENTT <n2> AS IDENTT<n3> SEMICOLONN<l>
{ let () = echo dyp.global_data l in fun e -> F.compose n1 n2 n3 e}
| HELP SEMICOLONN
<l>
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help None) in e}
| all_commands
<c> HELP SEMICOLONN<l>
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some c)) in e}
| LOAD_HELP SEMICOLONN
<l>
{let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Load)) in e}
| CREATE_SIG IDENTT
<n> SEMICOLONN<l>
{let () = echo dyp.global_data l in fun e -> F.create_sig n e}
| CREATE_LEX IDENTT
<n> IDENTT<n1> IDENTT<n2> SEMICOLONN<l>
{let () = echo dyp.global_data l in fun e -> F.create_lex ~abs:n1 ~obj:n2 n e}
| optional_idents
<names> SAVE<filename,l,line>
{ let () = echo dyp.global_data line in fun e ->
match names with
| [] -> let () = F.save filename e l in e
| _ -> let () = F.save ~names filename e l in e}
...
...
@@ -151,12 +151,12 @@
optional_ident :
| {None}
| IDENTT
[id]
{Some id}
| IDENTT
<id>
{Some id}
optional_idents :
| {[]}
| IDENTT
[id] optional_idents[ids]
{id::ids}
| IDENTT
<id> optional_idents<ids>
{id::ids}
%%
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment