John C. McCabe-Dansted wrote: > On Wednesday 23 November 2005 23:51, Angus Leeming wrote: >> Asger Ottar Alstrup wrote: >> > John C. McCabe-Dansted wrote: >> >> I am working on a grammar checker for LyX. It outputs the errors >> >> to LaTeX .log format so it can integrate itself into LyX without >> >> need for any modification to existing LyX binary. >> >> Hi, John. This is really nice and at 722 lines long (including >> copious commentary) is really small. That's great because it means >> that it'll be maintainable in the future. > > Thanks, though I expect it will be 1500+ lines of code and 50+ KB of > data files for the English language when feature complete. > >> I'd second Asger's suggestion that you investigate chktex. Most of >> the hooks are there already to able you to get on-screen >> notification of grammar problems, essentially for free. > > Yes, at this point I think I should write it as chktex v2, and > ignore anything LyX specific for the meanwhile, particularly while > there is feature freeze. > > Ultimately I would want to add hooks to LyX to support new features > like "This is not a grammatical error, because...", but there is no > point in adding these hooks until my code is robust. > > The final version will be at least 50KB uncompressed including data > files for the English language. If I don't try to integrate the core > into LyX I won't have to worry about keeping it small enough to be a > patch. > >> Interested? > > Yes.
What you write reads to me as a well thought out proposal. LyX has the potential for excellent support for communication with an external process such as yours, albeit one that is currently rather clunky and which works only on unix (and as far as the fifo pipes are concerned, only on some flavours of unix at that). I'm sure that any requests from you to add extra LFUNs to improve the communication between LyX and your tool will be received warmly ;-) >> Asger's suggestion that you rewrite this thing in C++ is also >> worthy of serious consideration. We know C++. We don't know Perl. >> That means > > If I was aiming it as a replacement for chktex, I may want to write > it as ANSI C (as with chktex), but then it probably wouldn't be the > LyX programmers I would be asking to maintain the code. Fair enough. >> that you'll get little or no help in maintaining your creation ATM, >> for purely practical reasons. Given that the heart of your beast is >> a bunch of regexes, you should have no problems moving to C++. >> (Boost.Regex which we use already provides a drop in replacement >> for your Perl regexes.) > > I had a look at Boost.Regex. I am not sure if I need or want regexes > in the final release anyway. If you don't use regexes to parse the latex log file, then presumably you're looking at a formal parser of the log file language, no? That seems a little heavy for what you're trying to achieve. If I've read you correctly then you may find the docs of the Boost.Spirit library an interesting read. -- Angus