Skip to content

A simple yet powerful expression language for .net string literals.

License

Notifications You must be signed in to change notification settings

eknowledger/XPress

Repository files navigation

XPress Logo

XPress

XPress is a simple yet powerful expression language for .net string literals. Using XPress compiler you can create string truth expressions at compile time using binary, unary, relational, and conditional operators. XPress compiles expressions into an optimized cacheable predicates that can be evaluated at runtime by binding variable to runtime values. XPress supports numerical, text, boolean, null, and variable operands.

Build status codecov NuGet NuGet License

How do I get started?

First, instaniate XpressCompiler object, create Xpress string expression, compile and you're done!

XpressCompiler _compiler = XpressCompiler.Default;

// Create and Compile Expression
var expression = "(x ne null and x+1 gt 10) or (y ne null and (y*(5+1)-2) lt 5)";
var compilationResult = _compiler.Compile(code);

// Create XpressRuntimeContext object with variable names and values
XpressRuntimeContext runtimeCtx = new XpressRuntimeContext() { { "x", "10" }, { "y", "9" } };

// Call compiled Func with runtimecontext
var result = compilationResult.Code(runtimeCtx);

More examples in the wiki.

Where can I get it?

First, install NuGet. Then, install XPress from the package manager console:

PM> Install-Package XPress

How can I contribute?

What do I need?

Download and Install Visual Studio 2017 Community/Professional/Enterprise Edition, and .Net 4.7 or higher.

How do I get source code?

  • Clone XPress source Code to your local dev box
git clone --recursive https://github.com/eknowledger/XPress.git
  • Open Eknowledger.Language.Xpress solution in Visual Studio
  • Start hacking!
  • Add Unit Tests.
  • Run Build Scripts locally.
  • Commit your changes
  • Submit a Pull Request and i will try to review your changes as oon as possible.

If you'd like to contribute but don't have any particular features in mind to work on, check out issue tracker and look for something that might pique your interest!

How Do I build solution?

Command Line

Run build.bat in command line window, then choose build type:

  • R: Build Release
  • T: Build Debug & Run Test Coverage
  • D or any other key: Build Debug
build

Powershell Scripts

Run debug script in powershell command line window with admin privilages, to compile and run unit tests without code coverage report or packaging.

.\debug.ps1

Run debug-cover script in powershell command line window with admin privilages, to compile and run unit tests with code coverage report.

.\debug-cover.ps1

Run release script in powershell command line window with admin privilages.

.\release.ps1

How do I Run Tests?

Eknowledger.Language.Xpress.Test contains extended list of unit tests covering many cases of XPress expressions. You can run unit tests using Visual Studio test explorer, or in command line using debug.ps1 script

How do i report a bug or a feature request?

Open a new issue. Provide details and code samples. Before opening a new issue, please search for existing issues to avoid submitting duplicates. You can always roll up your sleeves and contribute a fix!

Built With

  • Irony - .NET Language Implementation Kit
  • xUnit - Unit testing Framework
  • psake - build automation tool
  • OpenCover - Code Coverage Anlaysis Framework
  • Appveyor - Build and Continious Integration
  • Codecov - Code Coverage Reporting Tool

Versioning

XPress uses SemVer for versioning. For the versions available, see the tags on this repository.

License

XPress is Copyright © 2019 Ahmed Elmalt under MIT license.