On Thu, 27 Jan 2005, Kaspar Schiess wrote: > (In response to news:Pine.GSO.4.60.0501261622400.24999 > @brains.eng.cse.dmu.ac.uk by Hugh Sasse Staff Elec Eng) > >> I seem to have run into my parsing problem again. [...] >> So I'm wondering what other people do. > > Just a few random thoughts: > > - All of this depends on how complex your mini-language is. Should it be > Turing complete or just really something like fstab ? See > http://www.faqs.org/docs/artu/ch08s01.html (a chapter from the Art of > Unix Programming, including a taxonomy of languages). Interesting that declarative languages are considered less general, but that may be an artifact of those selected for the figure. > > - If your language needs loopiness and control constructs like Ruby has Mine doesn't, but... > (or should look like Ruby), then you could help me think about a cut-down > version of Ruby for configuration files: This version of Ruby should be Yes, I'd like one of those. Even having Lua Tables as a native data type to Ruby would be a big help, but this would be good to have for the more general case. , > accessible from within Ruby and be totally safe (=cut off of the external > world). Such a thing would have to be execution timeouted (endless loops > and stack overflows) too... Good idea. > > - Your problem was essentially the topic of one of my semester projects. > I tried out a lot of different parser generators, for different > languages. None really could score in the category of simplicity. > Probably just a complex subject. But the problem of having to create a > minilanguage pops up all the time, as you say. Thanks for this confirmation that I'm still on the right track! :-) > > - Parse error reporting: A lot of programming languages have bad parse > error reporting, which essentially comes from the fact that the parser > generator does not help you in this. ANTLR is a bit better there, but IMO > still sucks. Yes it is difficult. I think you have to sprinkle '.' all over yacc grammars to do this. > > I think there are two really good ideas in this thread: > a) Create and Integrate Grammars as first class objects in Ruby. > (Clifford Heath) > b) Use a cut-down version of Ruby that is designed with security in mind > (various people, this has been done). > > I can't help feeling that we're missing a really simple way to do all of > this ... I think so too, but I can't see the wood for the trees... > > kaspar > > hand manufactured code - www.tua.ch/ruby > Hugh