44#include "EST_cutils.h"
47static LISP lts_find_feasible_pairs(
LISP rules);
52static LISP lts_find_alphabets(
LISP rules);
78 fp = lts_find_feasible_pairs(rules);
85 cons(cons(rintern(
"or"),fp),NIL)));
88 for (r=rules; r != NIL; r=cdr(r))
111static LISP lts_find_alphabets(
LISP rules)
117 for (r=siod_nth(3,rules); r != NIL; r=cdr(r))
119 in = add_alpha(find_ins(car(r)),
in);
120 out = add_alpha(find_outs(car(r)),
out);
132 for (t=n; t != NIL; t=cdr(t))
133 if (!siod_member_str(get_c_string(car(t)),
e))
146 for (c=
rule; c != NIL; c=cdr(c))
148 if (streq(
"[",get_c_string(car(c))))
150 else if (streq(
"]",get_c_string(car(c))))
165 for (c=
rule; c != NIL; c=cdr(c))
167 if (streq(
"=",get_c_string(car(c))))
170 outs = cons(car(c),outs);
172 return reverse(outs);
175static LISP lts_find_feasible_pairs(
LISP rules)
185 for (r=rules; r != NIL; r=cdr(r))
187 LISP in = find_ins(car(r));
194 if (!siod_member_str(get_c_string(car(p)),fp))
195 fp = cons(car(p),fp);
210 if (siod_llength(
in) > siod_llength(
out))
211 m = siod_llength(
in);
213 m = siod_llength(
out);
215 for (i=
in,
o=
out ;
m > 0; --
m,i=cdr(i),
o=cdr(
o))
220 is = get_c_string(car(i));
224 os = get_c_string(car(
o));
225 fp = cons(strintern(is+
"/"+
os),fp);
238 r = analyse_rule(
rule);
271 for (l=
rule; l != NIL; l=cdr(l))
273 if ((state==0) && (!streq(
"[",get_c_string(car(l)))))
274 LC = cons(car(l),
LC);
275 else if ((state==0) && (streq(
"[",get_c_string(car(l)))))
277 else if ((state==1) && (!streq(
"]",get_c_string(car(l)))))
278 in = cons(car(l),
in);
279 else if ((state==1) && (streq(
"]",get_c_string(car(l)))))
281 else if ((state==2) && (!streq(
"=",get_c_string(car(l)))))
282 RC = cons(car(l),
RC);
283 else if ((state==2) && (streq(
"=",get_c_string(car(l)))))
292 return cons(reverse(
LC),
293 cons(make_fp(reverse(
in),
out),
294 cons(reverse(
RC),NIL)));
303 for (r=l; r != NIL; r=cdr(r))
305 LISP s = expand_set(car(r),fp,
sets);
306 if (cdr(r) && (streq(
"*",get_c_string(car(cdr(r))))))
308 es = cons(cons(rintern(
"*"),s),
es);
311 else if (cdr(r) && (streq(
"+",get_c_string(car(cdr(r))))))
313 es = cons(cons(rintern(
"+"),s),
es);
317 es = cons(cons(rintern(
"and"),s),
es);
325 LISP set = siod_assoc_str(get_c_string(p),
sets);
332 for (s=set; s != NIL; s=cdr(s))
334 for (f=fp; f != NIL; f=cdr(f))
339 if (
sf.contains(
ss+
"/"))
354 for (
m=
MAP;
m != NIL;
m=cdr(
m))
356 p = get_c_string(car(
m));
368 for (
np=NIL,r=fp; r != NIL; r = cdr(r))
370 rr = get_c_string(car(r));
371 if (
rr.contains(
"/"))
381 if ((s ==
sr) && (l !=
lr))
382 np = cons(car(r),
np);
387 return reverse(
notrp);
EST_String before(int pos, int len=0) const
Part before position.
int contains(const char *s, int pos=-1) const
Does it contain this substring?
EST_String after(int pos, int len=1) const
Part after pos+len.
void uunion(EST_TList< EST_WFST > &wl)
EST_write_status save(const EST_String &filename, const EST_String type="ascii")
?
void intersection(EST_TList< EST_WFST > &wl)