From: Trond Ydersbond on
Is there an open source grammar for the SAS language (or important
subsets)? I have searched this group, and the closest I came to an
answer was a mentioning of the need for this in 1995... In the Carolia
project (http://www.dullesopen.com/), they used, successfully, the
antlr (Java) compiler tool for implementeing a signifiicant subset of
SAS, but it does not seem like the reverse engineered SAS grammar they
used has been published.

Why should anyone need such a grammar? Well, just think about it.

Trond
From: Savian on
On Feb 9, 3:44 am, Trond Ydersbond <t_a_ydersb...(a)yahoo.no> wrote:
> Is there an open source grammar for the SAS language (or important
> subsets)? I have searched this group, and the closest I came to an
> answer was a mentioning of the need for this in 1995... In the Carolia
> project (http://www.dullesopen.com/), they used, successfully, the
> antlr (Java) compiler tool for implementeing a signifiicant subset of
> SAS, but it does not seem like the reverse engineered SAS grammar they
> used has been published.
>
> Why should anyone need such a grammar?  Well, just think about it.
>
> Trond

Why do you need it? Are you going to create a parser?

I have most of it (procs at least) but I am unsure whether I would
release it w/o knowing why. Similarly, I have the regex for a lot of
the language that I use in my SAS cleanup tool.

Alan
http://www.savian.net
From: Trond Ydersbond on
On 9 Feb, 13:11, Savian <savian....(a)gmail.com> wrote:
> Why do you need it? Are you going to create a parser?
>
> I have most of it (procs at least) but I am unsure whether I would
> release it w/o knowing why. Similarly, I have the regex for a lot of
> the language that I use in my SAS cleanup tool.

If you have any doubts about releasing, don't do it.
And I'm sure quite a few have something similar to what you have...
Having put quite a lot of work into it, too.. Think about that.

If you can't see why someone should need it, well, don't bother.

Then, you might think a bit about why R is such an enormous success.

If I can't find it elsewhere, I'm going to start doing a subset,
usable for antlr. And I will publish it.

The list of potential uses for such a grammar is very, very long.

Trond
From: Savian on
On Feb 9, 6:08 am, Trond Ydersbond <t_a_ydersb...(a)yahoo.no> wrote:
> On 9 Feb, 13:11, Savian <savian....(a)gmail.com> wrote:
>
> > Why do you need it? Are you going to create a parser?
>
> > I have most of it (procs at least) but I am unsure whether I would
> > release it w/o knowing why. Similarly, I have the regex for a lot of
> > the language that I use in my SAS cleanup tool.
>
> If you have any doubts about releasing, don't do it.
> And I'm sure quite a few have something similar to what you have...
> Having put quite a  lot of work into it, too.. Think about that.
>
> If you can't see why someone should need it, well, don't bother.
>
> Then, you might think a bit about why R is such an enormous success.
>
> If I can't find it elsewhere, I'm going to start doing a subset,
> usable for antlr. And I will publish it.
>
> The list of potential uses for such a grammar is very, very long.
>
> Trond

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.

Alan
http://www.savian.net
From: Trond Ydersbond on
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.