3 ms·
You'll first have to parse the SAS code, then output python or some other intermediate form. Does an open source parser exist? Golang did a C to Go transpile,
by verdverm 7y ago
You'll first have to parse the SAS code, then output python or some other intermediate form.
Does an open source parser exist?
Golang did a C to Go transpile, there are some articles and maybe a talk on it out there. It likely won't be 100% perfect, so you will need tests to verify correctness.
I have a tool that isn't open source yet, but it could be quite useful if you can get SAS to an AST in json or other data format. Hit me up if you'd be interested in talking about that option.
- passer_byer 7y agoThanks for that. There is no open source SAS parser. There are commercial versions, but that is why I ask about a generalized approach, so as not to build a bespoke parser. There are a couple of Python libraries for converting SAS datasets into dataframes which I plan to use. Converting the existing program logic is the main challenge.
- verdverm 7y agoMaybe check out PEG parser generators, they are easier to reason about compared to older things, but are less capable, though often sufficient