From: Kaspar Schiess Date: 2005-01-27T17:10:35+09:00 Subject: Re: When little languages grow... (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. Whatever I'm > doing I usually end up having to parse non-simplistic input, and I'm > still not happy about the apparently available solutions to this. > 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). - If your language needs loopiness and control constructs like Ruby has (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 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... - 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. - 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. 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 ... kaspar hand manufactured code - www.tua.ch/ruby