GithubHelp home page GithubHelp logo

classicvalues / common-xtext-expression-language Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intuit/common-xtext-expression-language

0.0 1.0 0.0 2.76 MB

common-xtext-expression-language (CXEL) is an Xtext based DSL and a java runtime engine for expressions and commonly used functions for data transformations

License: Apache License 2.0

Java 75.74% Groovy 21.95% Xtend 0.82% HTML 0.66% CSS 0.82%

common-xtext-expression-language's Introduction

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. It can also be used to evaluate expressions independently. Currently, the runtime is in Java language but it can be updated to any other language as well.

Targeted Users

DSL Developers who need to run expressions in their DSL can import the Common-Xtext-Expression-Language and the ready-to-use runtime engine in the DSL.

Usage

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

#Example

let’s say you are creating a new DSL for representing a rule engine. Something like below:

Rules myRules {
      when ${expression} then rule1
      when ${expression} then rule2
      when ${expression} then rule3
}

You can import the expression language to represent the ${expression} in your DSL and execute the available expressions from the Common-Xtext-Expression-Language.

Setting up the Project

Pre-requisites

  1. Java 8
  2. Maven 3

Making changes to Runtime

  • Clone common-xtext-expression-language
  • Run mvn 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

common-xtext-expression-language's People

Contributors

ashpak-shaikh avatar cnachino avatar classicvalues avatar ishanidoshi avatar hipstersmoothie avatar bhavinshah7 avatar mend-bolt-for-github[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.