I would like to port to R the IPAT-S language, kind of a 'domain specific' scripting language for developing quantitative models for medium and long-term sustainability scenarios (www.ipat-s.org). I think that in order to replicate its syntax I need some kind of 'macro' functionality to reparse it into R constructs. Are there any examples of tweaking R to support a domain specific input syntax? Thanks a lot, -- You cannot manipulate a marionette with only one string -The Zensunni Whip (Frank Herbert, Dune) g+ ? ? ?>> http://bit.ly/M25XDX twitter >> https://twitter.com/#!/flat__line web ? ?>> http://osservatorio.energia.provincia.tn.it
On 12-06-21 7:20 AM, Roberto Brunelli wrote:> I would like to port to R the IPAT-S language, kind of a 'domain > specific' scripting language for developing quantitative models for > medium and long-term sustainability scenarios (www.ipat-s.org). > > I think that in order to replicate its syntax I need some kind of > 'macro' functionality to reparse it into R constructs. Are there any > examples of tweaking R to support a domain specific input syntax? > > Thanks a lot, >There are two approaches: invent a new interpretation for R syntax, and just use the regular parse() function together with a new way of evaluating it (the approach used in model formulas), or write a full fledged parser for your language. The latter is used by tools::parse_Rd. It sounds as though you want the second approach. I don't know of any examples of full parsers written in R. Most of parse_Rd is written in Bison and C code. Duncan Murdoch
Possibly Parallel Threads
- S4 object slot of type 'call'
- Selective 'expansion' of arguments in a match.call() result ...
- do.call and plotting functions ...
- Applying a function to a list of arguments ...
- Re: MCollective Client Languages (WAS Re: Re: Accessing Facter in other languages than Ruby?)