Thread: Re: [q-lang-users] Compilation time
Brought to you by:
agraef
From: Arnoldo M. <arn...@gm...> - 2006-05-19 05:14:57
|
Dear Dr Albert: Thank you for your prompt reply. Well, yeah the rules are generated and they are actually term rewriting rules. checkAvailability (X,Y) could be written in q as X =3D Y. However I don't really want to transform expressions, I want to find patterns between pairs of expressions and make sure that the pattern I find is in a database. The file I sent you is the database of "learned" patterns I will try the suggestion you gave me. Thank you. What I've been doing is t= o put all these learned patterns in a database as strings (in a hash table), and learn a new pattern every time I want to match expressions and search the hash table. Maybe your suggestion is faster than learning the pattern each time. Sorry for the huge delay, but japanese works like a charm in 7.0 : ) regards, Arnoldo On 5/19/06, q-l...@li... < q-l...@li...> wrote: > > Send q-lang-users mailing list submissions to > q-l...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/q-lang-users > or, via email, send a message with subject or body 'help' to > q-l...@li... > > You can reach the person managing the list at > q-l...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of q-lang-users digest..." > > > Today's Topics: > > 1. Re: Compilation time (Albert Graef) > 2. Re: Compilation time (Albert Graef) > 3. Re: CVS head failed to build, flex yytext_ptr problems (Peter > Minten) > 4. Love is a canvas furnished by Nature and embroidered by imagination > (caleb nikolaus) > 5. Re: Request to add new reserved words "quote" and > "QUOTE" to Q (Albert Graef) > 6. Re: Q as a 2Lisp (Albert Graef) > 7. Re: Q as a 2Lisp (Albert Graef) > 8. Re: Request to add new reserved words "quote" and "QUOTE" to Q (Joh= n > Cowan) > > --__--__-- > > Message: 1 > Date: Thu, 18 May 2006 07:05:36 +0200 > From: Albert Graef <Dr....@t-...> > To: q-l...@li... > Subject: Re: [q-lang-users] Compilation time > Reply-To: q-l...@li... > > Arnoldo Muller wrote: > > I am trying to compile a 106 rule script (attached in this e-mail). I > > started it an hour ago and hasn't finished yet. > > Nice one. ;-) Could be one of the rare cases where the deterministic > matching automaton has an exponential size. But more likely it's just a > bug. I'll have to look into it. > > Albert > > -- > Dr. Albert Gr"af > Dept. of Music-Informatics, University of Mainz, Germany > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikinformatik.uni-mainz.de/ag > > > --__--__-- > > Message: 2 > Date: Thu, 18 May 2006 09:02:51 +0200 > From: Albert Graef <Dr....@t-...> > To: q-l...@li... > Subject: Re: [q-lang-users] Compilation time > Reply-To: q-l...@li... > > Dear Arnoldo, > > Arnoldo Muller wrote: > > I am trying to compile a 106 rule script (attached in this e-mail). I > > started it an hour ago and hasn't finished yet. > > Sorry for the bad news, but it looks like you really hit one of the > (few?) cases where the deterministic left-to-right tree matching > automaton is exponentially larger than the nondeterministic one. > Specifically, it seems that the number of states triples with each rule > (at least some of them), and you can imagine where that leads... In > fact, I isolated three of the rules near the beginning of your script > which already produce an automaton with more than 4500 states. And the > effect even gets worse with a bugfix I recently did to resolve an > obscure bug in the pattern matching code. :( > > Well, it's the first real-world example that I see which exhibits the > behaviour. I suppose that your ruleset is generated in some way? > > There's still the faint possibility that there might be a bug in my > implementation of the pattern matching algorithm, I'll have to take > another look at the generated automata to figure this out. Even if it > doesn't turn out to be a bug, there might be ways to cope with the > situation, but not with deterministic left-to-right matching, and in any > case that surely needs a complete overhaul of the pattern matching > algorithm. (AFAICS, using backtracking matching is not an option in > general, since that would make the pattern matching much too slow.) > > To work around this problem, the only thing I can suggest right now is > to rewrite the overlapping rules in order to reduce the complexity. E.g.: > > checkAvailability (X,Y) =3D true where X =3D farrayRef (V0,fphi > (fintConstant 1,V1)), Y =3D farrayRef (V0,fphi (flocalRef BC0,V1)); > > I know that this is not very convenient (kind of defeats the purpose of > using term rewriting), and it will also be slow since this effectively > makes the pattern matching work in a backtracking way. But I hope it's > still a workable solution until I find something better. > > Cheers, > Albert > > -- > Dr. Albert Gr"af > Dept. of Music-Informatics, University of Mainz, Germany > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikinformatik.uni-mainz.de/ag > > > --__--__-- > > Message: 3 > Date: Thu, 18 May 2006 10:28:41 +0200 > From: Peter Minten <pet...@wa...> > To: q-l...@li... > Subject: Re: [q-lang-users] CVS head failed to build, flex yytext_ptr > problems > Reply-To: q-l...@li... > > Albert Graef wrote: > > Peter Minten wrote: > >> This works. However when I removed the qclex.c file (which was in the > >> archive) and ran make again to recreate the file it fails in exactly > >> the same way as before (not suprisingly as there is no difference > >> between the 7.1rc2 qclex.l file and the one in CVS HEAD). > > > > Ok, so we know for sure now that it's a flex compatibility issue. > > > > The necessary change apparently is to move all the routines which use > > unput to the first %{ %} code section of the Lex source. Unfortunately, > > that doesn't work with older Flex versions. Stupid. :( > > > > I've attached a patch which I *think* should make qmlex.l compile, > > according to the little documentation that I have about this "feature" > > of the new flex version. Could you please try whether that works for > you? > > ~/Desktop/q-7.1/src$ make > /bin/sh ../ylwrap qmlex.l lex.yy.c qmlex.c -- flex -I > if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../libltdl -DYEAR=3D'"2006"' > -DSYSINFO=3D'"i686-pc-linux"' > -DQPATH=3D'".:/usr/local/share/q/lib:/usr/local/lib/q"' > -DQEXEC=3D'"/usr/local/bin/q"' -DLIBTOOL=3D'"/usr/local/lib/q/libtool"' > -DCC=3D'"gcc"' -g -O2 -MT libglobs_a-qmlex.o -MD -MP -MF > ".deps/libglobs_a-qmlex.Tpo" -c -o libglobs_a-qmlex.o `test -f 'qmlex.c' > || echo './'`qmlex.c; \ > then mv -f ".deps/libglobs_a-qmlex.Tpo" ".deps/libglobs_a-qmlex.Po"; > else rm -f ".deps/libglobs_a-qmlex.Tpo"; exit 1; fi > qmlex.c:1396: warning: conflicting types for 'yyunput' > qmlex.c:1396: error: static declaration of 'yyunput' follows non-static > declaration > qmlex.l:287: error: previous implicit declaration of 'yyunput' was here > qmlex.c:1411: error: static declaration of 'input' follows non-static > declaration > qmlex.l:202: error: previous implicit declaration of 'input' was here > qmlex.l:669: error: static declaration of 'initbuf' follows non-static > declaration > qmlex.l:343: error: previous implicit declaration of 'initbuf' was here > qmlex.l:674: error: conflicting types for 'addbuf' > qmlex.l:674: note: an argument type that has a default promotion can't > match an empty parameter name list declaration > qmlex.l:298: error: previous implicit declaration of 'addbuf' was here > make: *** [libglobs_a-qmlex.o] Error 1 > > Greetings, > > Peter > > > --__--__-- > > Message: 4 > From: "caleb nikolaus" <eye...@co...> > To: "gene jakeb" <q-l...@li...> > Date: Thu, 18 May 2006 10:10:54 +0000 > Subject: [q-lang-users] Love is a canvas furnished by Nature and > embroidered by imagination > Reply-To: q-l...@li... > > ------=3D_NextPart_000_A89B_53D40CE1.F627A89B > Content-Type: text/html; charset=3Dus-ascii > Content-Transfer-Encoding: 7bit > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > <title>defense laboredly</title> > <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-asci= i"> > </head> > > <body> > <b>Hail!</b><br> > <div align=3D"center"> > <IMG src=3D"cid:0ce1f627a89b$53d40ce1$f627a89b@makenzie" border=3D"0"><br= > > <strong><font size=3D"5" face=3D"Verdana, Arial, Helvetica, sans-serif"> > comisarovnety<font color=3D"#CC0000">[dot]</font>com</font></strong><br> > <br><br>---- > <p>He had only five birds in his game-bag when he walked out of the > marsh towards the alders where he was to rejoin Stepan > Arkadyevitch. > Before he caught sight of Stepan Arkadyevitch he saw his dog. > Krak darted out from behind the twisted root of an alder, black > all over with the stinking mire of the marsh, and with the air of > a conqueror sniffed at Laska. Behind Krak there came into view > in the shade of the alder tree the shapely figure of Stepan > Arkadyevitch. He came to meet him, red and perspiring, with > unbuttoned neckband, still limping in the same way. > "Well? You have been popping away!" he said, smiling > good-humoredly. > "How have you got on?" queried Levin. But there was no need to > ask, for he had already seen the full game bag. > "Oh, pretty fair." > He had fourteen birds. > "A splendid marsh! I've no doubt Veslovsky got in your way. > It's awkward too, shooting with one dog," said Stepan > Arkadyevitch, to soften his triumph. > Chapter 11 > When Levin and Stepan Arkadyevitch reached the peasant's hut > where Levin always used to stay, Veslovsky was already there. He</p> > <br> > </div> > </body> > </html> > ------=3D_NextPart_000_A89B_53D40CE1.F627A89B > Content-Type: image/gif; name=3D"nylcfpr.gif" > Content-Transfer-Encoding: base64 > Content-ID: <0ce1f627a89b$53d40ce1$f627a89b@makenzie> > > > R0lGODdhugH8AMIAAP///8UNBO3t7QAAAACW/+EJCQAAAAAAACwAAAAAugH8AAAD/gi63P4wy= kmrvTjrzbv/YCiOZGmeaKqubOu+cIwOs0Obd17LHFH5AGBHuCC2bhQkSBdRcpwMKK9EMEqR2AtU= umxwm5bvVGKElHuOs0q82y7YH7diQB9vqtZHdq61nZxwXmF2GWoNhoVpMYElTFFva36ChBhVkoI= 0mW91fJ1YdHIAn3uiko6jNqBznF6qm6SoeqygUkJAeLZ4DLoKt0WWvUW/ucBBwxCuorOQqZx7mZ= rKrNJXy6VRqrTY1dbUq87J15QWxcyYpaed1+l+sOpyTO6T4qHwzKR674rBxvy2/P189Qso7BBAg= f/m6eNz5d69Zw7V5Vt3CaLEhewsmhv3/qNMQ00ZI+KDJG8kRXTbpi0UZ25UFpfc2O0qmLAmLn+9= bgYjorNmTl7YUirhotHRyaMxPVV8GA6jU6UbOVIod5EhSnpPTV7FyvXRumli5HlFSjLqPJkFCeJ= cO1OtwYRuESYxOvbsU6hk7R5tGRGZyL5GGUkN4tHvypBdFRY1hdekWL6Jh5pdbJCtwLhr4Q4ceF= kuQMb6GjaWiJhl1qWj9ZamO7hjuS/4wmmj1zSq7NrxWqrc9G0ibbCtiLrS2pMmUMI+f1YedgsoM= VlDuyX9FvhwbW97ecPazdWl9aqtB9kRHL68+fO+zZNHX2E9Dvbw48u/zpG+/Pv48+vfz7+//v//= AAYo4IAKjdeBe5YgMkEg7nnVIIEQRjiCTuA91kgGWpGRyBMesBGLhCCGeEdzZnX1YHsYlqhhJQd= 2uOAlIsYo41REfLRVMrNh11sz0W2RzW1Q3OQLMLpQ6Ml1OUpDEiDv1JHkiTNG+R9VNkbjIGAw3l= UPlsuR+NlmXI6VkWh0MSnl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z31eY7CgchVDiIdSYTdCNq6zefKWXh0Vhe0EPzxJf/mv7exTwuLIshcw4evqNbUEH7v= Bj4XGzrkuE61xzrrLUDovm7sW3utVf/p5Nznko35Db3pYJYAADs=3D > ----=3D_NextPart_000_A89B_53D40CE1.F627A89B-- > > > > --__--__-- > > Message: 5 > Date: Fri, 19 May 2006 02:42:10 +0200 > From: Albert Graef <Dr....@t-...> > To: q-l...@li... > Subject: Re: [q-lang-users] Request to add new reserved words "quote" and > "QUOTE" to Q > Reply-To: q-l...@li... > > This is a multi-part message in MIME format. > --------------070802080107040407060600 > Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed > Content-Transfer-Encoding: 7bit > > John Cowan wrote: > > Good point, and I think "def" will suffice for now. That allows one to > pass > > a value in to be evaluated by an already-existing expression without > > having to cons up a new expression. > > That's in CVS now. A simple example is attached below. > > > There's a couple of problems with libqint on Cygwin: > > > > 1) You have to link with -lqint -lgmp -liconv -lq explicitly in order t= o > > satisfy the linker. The -liconv was expected, as Cygwin doesn't have > > iconv in its default library. Without -lq, it reports: > > Looks like Cygwin gcc is not very clever in resolving dependencies in > linked shared libs. With both Linux gcc and mingw I only have to specify > -lqint. > > > Should I be using libtool, and if so, how? > > Then you'll have to use libtool to compile your sources, too. If you > want to do this, the easiest way to go is to autotoolize your program > and use an automake Makefile. Automake makes handling libtool libraries > much easier. > > > 2) More seriously, the sample programs in Appendix C crash when trying > > to pass additional arguments to qexecl and qexeclx, either with a SIGHU= P > > or with a SIGABRT. The poor man's Q interpreter will crash if you give > > it command-line arguments other than the script, and the hello-world > > program crashes when it tries to load the internal script. > > Strange. Both programs work just fine over here, both on Linux and > Windows/mingw. Do you have a gdb backtrace? > > > Changing hello.c to use qexeclx(script, strlen(script), 1, > strdup("Hello!")); > > works fine, and changing it to use qexeclx(script, strlen(script), 0) > > sort of works, except that the value of ARGS is ["/tmp/tc40.2"], Ghu > > only knows why -- there is no such file. > > Everything o.k. with that. qexeclx() creates a temporary script file > which is removed again as soon as the interpreter has loaded the script. > > > I realize you probably can't do much about this, but I'm passing it > along > > in hopes that you can think of something. > > Could be a bug in the interpreter's main (although I doubt this since it > doesn't show with mingw). Anyway, a backtrace would be helpful since I > cannot reproduce the error. ;-) > > Albert > > -- > Dr. Albert Gr"af > Dept. of Music-Informatics, University of Mainz, Germany > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikinformatik.uni-mainz.de/ag > > --------------070802080107040407060600 > Content-Type: text/x-csrc; > name=3D"vardef.c" > Content-Transfer-Encoding: 7bit > Content-Disposition: inline; > filename=3D"vardef.c" > > #include <stdlib.h> > #include <stdio.h> > #include <string.h> > #include <qint.h> > > int main(int argc, char **argv) > { > int status; > > char *script =3D "def TEST =3D 99;"; > > qexeclx(script, strlen(script), 0); > > /* change the value of an existing variable */ > printf("TEST =3D=3D> %s\n", qeval("TEST", &status)); > status =3D qdef("TEST", qevalx(qparse("TEST+2", &status), &status)); > printf("TEST =3D=3D> %s\n", qeval("TEST", &status)); > > /* create a new variable in the global scope */ > printf("MYTEST =3D=3D> %s\n", qeval("MYTEST", &status)); > status =3D qdef("MYTEST", qevalx(qparse("TEST+2", &status), &status)); > printf("MYTEST =3D=3D> %s\n", qeval("MYTEST", &status)); > > exit(0); > > } > > --------------070802080107040407060600-- > > > --__--__-- > > Message: 6 > Date: Fri, 19 May 2006 02:54:10 +0200 > From: Albert Graef <Dr....@t-...> > To: q-l...@li... > Subject: Re: [q-lang-users] Q as a 2Lisp > Reply-To: q-l...@li... > > John Cowan wrote: > > Of course, Q is a lot more flexible than 2Lisp is. But again, it's > > interesting that there is a 2Lisp core to Q. > > Yes, looks like even without knowing 2Lisp I arrived at some similar > ideas about doing reflection. ;-) Do you know whether there is some > paper available online on this stuff? Or even an implementation of the > language? Google didn't turn up much (probably because this work dates > back to the pre-WWW days). > > -- > Dr. Albert Gr"af > Dept. of Music-Informatics, University of Mainz, Germany > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikinformatik.uni-mainz.de/ag > > > --__--__-- > > Message: 7 > Date: Fri, 19 May 2006 02:59:41 +0200 > From: Albert Graef <Dr....@t-...> > To: q-l...@li... > Subject: Re: [q-lang-users] Q as a 2Lisp > Reply-To: q-l...@li... > > Never mind, I just found the PhD thesis on library.readscheme.org. > > Albert Graef wrote: > > John Cowan wrote: > > > >> Of course, Q is a lot more flexible than 2Lisp is. But again, it's > >> interesting that there is a 2Lisp core to Q. > > > > > > Yes, looks like even without knowing 2Lisp I arrived at some similar > > ideas about doing reflection. ;-) Do you know whether there is some > > paper available online on this stuff? Or even an implementation of the > > language? Google didn't turn up much (probably because this work dates > > back to the pre-WWW days). > > -- > Dr. Albert Gr"af > Dept. of Music-Informatics, University of Mainz, Germany > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikinformatik.uni-mainz.de/ag > > > --__--__-- > > Message: 8 > Date: Thu, 18 May 2006 22:55:35 -0400 > To: q-l...@li... > Subject: Re: [q-lang-users] Request to add new reserved words "quote" and > "QUOTE" to Q > From: John Cowan <co...@cc...> > Reply-To: q-l...@li... > > Albert Graef scripsit: > > > That's in CVS now. A simple example is attached below. > > Thanks. > > > Looks like Cygwin gcc is not very clever in resolving dependencies in > > linked shared libs. With both Linux gcc and mingw I only have to specif= y > > -lqint. > > Not a big deal. > > > >Should I be using libtool, and if so, how? > > > > Then you'll have to use libtool to compile your sources, too. If you > > want to do this, the easiest way to go is to autotoolize your program > > and use an automake Makefile. Automake makes handling libtool libraries > > much easier. > > I don't think I want to go there, at least not yet. > > > >2) More seriously, the sample programs in Appendix C crash when trying > > >to pass additional arguments to qexecl and qexeclx, either with a > SIGHUP > > >or with a SIGABRT. The poor man's Q interpreter will crash if you giv= e > > >it command-line arguments other than the script, and the hello-world > > >program crashes when it tries to load the internal script. > > > > Strange. Both programs work just fine over here, both on Linux and > > Windows/mingw. Do you have a gdb backtrace? > > Well, running under gdb causes an entirely consistent pattern of > crashes, no matter how many arguments there are or are not. > I've attached gdb traces for pmq and for a modified version of hello > (also attached). > > In essence, there is a SIGSEGV inside cygwin1.dll, the master DLL > for Cygwin, when _sigfe is invoked from resolve (q.c:1809). > However, there is no explicit reference to _sigfe, so it may > be hidden behind a macro. > > > Everything o.k. with that. qexeclx() creates a temporary script file > > which is removed again as soon as the interpreter has loaded the script= . > > Ah. > > -- > John Cowan co...@cc... http://ccil.org/~cowan > This great college [Trinity], of this ancient university [Cambridge], > has seen some strange sights. It has seen Wordsworth drunk and Porson > sober. And here am I, a better poet than Porson, and a better scholar > than Wordsworth, somewhere betwixt and between. --A.E. Housman > > > > --__--__-- > > _______________________________________________ > q-lang-users mailing list > q-l...@li... > https://lists.sourceforge.net/lists/listinfo/q-lang-users > > > End of q-lang-users Digest > |
From: Albert G. <Dr....@t-...> - 2006-05-19 11:31:37
|
Hi Arnoldo, Arnoldo Muller wrote: > Well, yeah the rules are generated and they are actually term rewriting > rules. > checkAvailability (X,Y) could be written in q as X = Y. > However I don't really want to transform expressions, I want to find > patterns between pairs of expressions and make sure that the pattern I > find is in a database. The file I sent you is the database of "learned" > patterns Ok, I see. So what you actually need is a data structure to represent relations on arbitrary expressions. The easiest way to do this would be to store the pairs as keys in a hashed dictionary. Something like: learn T R = update T R true; available T R = member T R; Here, T is the table of learned rules (emptyhdict initially) and R the rule to be learned or checked. The associated value "true" could actually be anything, so you could also use it to store some more info with each learned rule. If you only need a simple global instance of the table, and you don't mind a little imperativeness, you can also do this with a global reference, as follows: def T = ref emptyhdict; learn R = put T (update (get T) R true); available R = member (get T) R; Then you could just do, e.g.: ==> learn (farrayRef (V0,fphi (fintConstant 1,V1)),farrayRef (V0,fphi (flocalRef BC0,V1))) ==> learn (fstaticInvoque (fmethodRef (AC0,AC1),V0),fphi (flocalRef BC0,V0)) ... That way, you don't have to keep track of the T parameter all the time. Of course, there are other ways to store such relations efficiently, but hdicts are probably the easiest way to go to solve your problem. If the rules don't get arbitrarily large then this implementation should certainly be fast enough. > What I've been doing > is to put all these learned patterns in a database as strings (in a hash > table), and learn a new pattern every time I want to match expressions > and search the hash table. No need to resort to strings there, with hdicts the keys can actually be arbitrary values. See http://q-lang.sf.net/qdoc/qdoc_11.html#SEC67. > Sorry for the huge delay, but japanese works like a charm in 7.0 > : ) Very good news, thanks for the report! And thanks for the nice real-world example of a pattern set which makes deterministic left-to-right matching explode. ;-) Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |