Strumenta / sas-parser-samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strumenta SAS Parser Samples

This is a collection of examples of usage of Strumenta's parser for the SAS language.

Note that the SAS parser is a commercial product and it's required to build and run these examples.

Strumenta Playground

On the Strumenta Playground you can see some code samples and their translation into an AST, an Abstract Syntax Tree that applications can analyze to extract information about a SAS program.

Example Usage (Java)

At https://github.com/Strumenta/sas-parser-samples/blob/main/src/main/java/com/strumenta/sas/samples/Covid19NYT.java you can find a Java code sample that uses the parser to print some information about a SAS file and the structure of the code.

Eclipse Ecore/EMF

To parse a SAS file and obtain an Ecore representation of it run:

java -jar sas-parser-<version>-jar-with-dependencies.jar <input.sas> emf <output.xmi> 

This will create two files:

  • metamodel.xmi containing the definition of the AST classes (that won't change between runs of the same version of the tool)
  • output.xml containing the actual AST objects

You should then be able to import both into Eclipse.

About

License:Apache License 2.0


Languages

Language:Java 100.0%