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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.