Skip to content

Common-Expression-Language

common-xtext-expression-language logo

The project provides an expression language built using Xtext and a runtime engine to evaluate the expressions. The expression grammar can be imported in other Xtext DSLs to create composable and reusable languages using Xtext.

Usage

  1. Add the maven dependency
      <groupId>com.intuit.dsl.expression</groupId>  
      <artifactId>com.intuit.dsl.expression.runtime</artifactId>
      <version>${latest}</version>
    
  2. Code usage
   DataValue value = ExpressionRuntime.newExpressionRuntime()
                           .withExpressionContent(expressionString)
                           .evaluate();

Setting up the Project

Pre-requisites

  1. Java 8
  2. Maven 3

Making changes to Runtime

  • Clone common-xtext-expression-language
  • Run maven clean install
  • Import the runtime module com.intuit.dsl.expression.runtime. This is standard java project which can be imported in your favorite editor.

Making changes to Expression Grammar

  1. Download and install Eclipse MAC / Windows / Linux.
  2. Install Xtext SDK in Eclipse:
    a. In Eclipse, click Help → Install New Software.
    b. In Available Software, click Add to add a repository with the following location http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
    c. Select the repository just added in 'Work with' dropdown.
    d. Select and install Xtext Complete SDK.
  3. Restart Eclipse.
  4. Edit the grammar
  5. Right click on GenerateExpression.mwe2. Run As → 1 MWE2 Workflow.

    OR

    mvn clean install inside the project

You should be able to use the grammar changes in your runtime.

Formatting

Read the Contribution guide