jrouaix / csharp-expr-rs

c# expression parser in Rust [very experimental]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

csharp-expr-rs

c# expression parser in Rust

Todo

  • Parse expressions with nom parser
  • Execute expressions
  • FFI create an expression from .net
  • Execute this expression from .net
  • Benchmark execution time against DynamicExpresso (.net expression interpreter) => .net version x2 better
  • Optimize so function are ready to call after first parsing => Rust now competes with DynamicExpresso
  • Benchmark "compilation" time => Rust x40 better
  • Debug trait for Expr
  • PartialEq trait for Expr
  • Parse '"str"ing"' as 'str"ing' value for Exp::Str (tried escaped_transfom but it changes the return types, perhaps find an other way, when creating the Expr::Str)
  • More unit tests (Rust side)
  • Handle identifiers
  • Handle identifier value and usage
  • Handle passing values arguments for identifiers from C# side
  • Benchmarks & Optimisations => cloning Expressions was a baaaaaad idea ! /10 perfs drop
  • Could we try some better syntax with type aliasing Rc, perhaps some macros ? okay, not bad, not great
  • Optimisation : Do not pass parameters throught FFI if they are not used by the expression !
  • More tests about identifiers list
  • Couldn't prepare a function inside an unknown function => OK, expected behavior
  • Handle null value (just in case)
  • Debug white space and tabs in strings are still strings
  • Segregate Expr & ExprResult enum types
  • Implement Sql Like function
  • Implement existing functions in BZP system
  • Case insensitive function names ... and identifier names
  • Result/Error handling on FFI for expressions execution
  • Debug strings should be able to contain any character ! see also : rust-bakery/nom#1118
  • Handle (good enough) non ascii strings
  • Handle numeric types as Decimal/Money with 4 digits precision (have to find the right crate : https://crates.io/crates/rust_decimal ?)
  • Debug empty parameters list parsing (it's parsed as identifier right now)
  • Handle functions determinism
  • Debug empty string parsing
  • refacto : remove all usage of opt(sp), the take_while in sp() should be enough do the optional trick
  • refacto : replace some preceded/terminated by 'delimited'
  • Handle C# Assoc/Binary operators parsing (only delimited by parenthesis)
  • Handle C# Assoc/Binary operators execution
  • Handle C# Assoc/Binary operators parsing with no parenthesis delimiter
  • Make FFI parse fail to return an error and raise a nice exception AND not panicking !
  • Handle timezones & day light save hours (thank you chrono-tz !)
  • sp() should get the new lines and allow the parsing to continue
  • Make C# FFI 1 char strings to Rust
  • Replace &Vec usage by slices (have a look at f_operators)
  • Handle non usefull parenthesis (some tests to uncomment)
  • Turn all possible overflow problems in casts (isize as u32, i32 ....) to nice errors
  • Rc strings to avoid cloning them
  • Rc and lazy load variable values and avoid read them multiple times when used multiple times
  • Optimisation : lazy evaluation for identifier value getters ? https://docs.rs/once_cell/1.2.0/once_cell/
  • comment out or remove dbg!()
  • Handle operators precedence !
  • Debug snake case identifiers parsing
  • Debug Identifiers (Some tests are not passing)
  • More perf benchmarks with arguments passing
  • Return the right result type throught FFI
  • Error handling on expressions parsing
  • Modularisation, so anyone can implement their own functions list
  • Allow passing functions from dotnet side to be called from rust expression ? // see System.Runtime.InteropServices.AllowReversePInvokeCallsAttribute
  • Publish on crates.io

Super helpfull resources

more reading ?

About

c# expression parser in Rust [very experimental]

License:MIT License


Languages

Language:Rust 85.5%Language:C# 14.5%