From: Savian on 10 Feb 2010 09:39 On Feb 10, 6:28 am, Trond Ydersbond <t_a_ydersb...(a)yahoo.no> wrote: > On 9 Feb, 18:17, Savian <savian....(a)gmail.com> wrote: > > > > > > > I know what the need was for and I agree on the usefulness. That said, > > you were very crytic in what you asked. > > > It isn't easy, btw, so you need to realize that from the get-go. > > Things are not delimited well and certain constructs are very, very > > hard to parse. I have mulled over building a flex/bison parser as well > > but I don't see much reason to go there at this time. I have a lot of > > the regex, especially for data step and have ALL of the procs > > documented in XML. > > > I don't think you will find anything on the web. The only ones I know > > who have worked in this area are WPS, Savian, and Carolina. WPS won't > > give it to you and I highly doubt Dulles Research would. > > > The procs are the hardest, btw along with the input statement. > > > SaviClean, found on my utilities page, will illustrate the parsing. > > Just paste in SAS code and give it a whirl. > > Thanks! > I am aware of at least some of the problems, think they go in part > back to SAS' Fortran heritage? > This is also why I think it is best to use tools like antlr. Scanning > and parsing can't really be distinguished completely from each other.- Hide quoted text - > > - Show quoted text - SAS should be primarily PL1 but it doesn't matter much. Scan it out and see what you come up with. Input statement is really, really nasty. Most of the other stuff is fine and is easy to work with. I would focus on the most basic of procs and ignore the more complex ones like IML. Here is an example of happiness: INPUT @20 X ?:$test5. ; or... INPUT +(-10) X ?:$test5. ; They all look easy until you view them as a whole and it gets complex. PUTs are the same.Macros also have their weirdness but it is all doable. I will assume you are doing to make a translator (R to SAS and vice- versa) but that is a guess ;-] Alan http://www.savian.net
First
|
Prev
|
Pages: 1 2 Prev: PROC APPEND and Memory Next: help with counting occurences of a string |