All Projects → RotBolt → KParser

RotBolt / KParser

Licence: Apache-2.0 license
Kotlin Multiplatform Arithmatic Parser

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to KParser

kfsm
Finite State Machine in Kotlin
Stars: ✭ 76 (+137.5%)
Mutual labels:  kotlin-native, kotlin-multiplatform, kotlin-mpp
moko-geo
Geolocation access for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 41 (+28.13%)
Mutual labels:  kotlin-native, kotlin-multiplatform
SQLiter
Minimal multiplatform sqlite library
Stars: ✭ 120 (+275%)
Mutual labels:  kotlin-native, kotlin-multiplatform
TMDbMultiplatform
Step-by-step guide on Kotlin Multiplatform
Stars: ✭ 86 (+168.75%)
Mutual labels:  kotlin-native, kotlin-multiplatform
Arbor
Like Timber, just different
Stars: ✭ 55 (+71.88%)
Mutual labels:  kotlin-native, kotlin-multiplatform
kinsight-multiplatform
Kotlin Multiplatform Concept - iOS, MacOS, WatchOS (SwiftUI), Android (phone and Wear OS), JVM Web Server - Alpha Capture
Stars: ✭ 38 (+18.75%)
Mutual labels:  kotlin-native, kotlin-multiplatform
moko-graphics
Graphics primitives for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 11 (-65.62%)
Mutual labels:  kotlin-native, kotlin-multiplatform
moko-web3
Ethereum Web3 implementation for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 32 (+0%)
Mutual labels:  kotlin-native, kotlin-multiplatform
cognito-idp
Lightweight AWS Cognito Identity Provider client for Kotlin Multiplatform and Typescript projects.
Stars: ✭ 14 (-56.25%)
Mutual labels:  kotlin-native, kotlin-multiplatform
moko-errors
Automated exceptions handler for mobile (android & ios) Kotlin Multiplatform development.
Stars: ✭ 45 (+40.63%)
Mutual labels:  kotlin-native, kotlin-multiplatform
KotlinMultiplatformAndoridParcelize
Use the Parcelize Annotation of the Kotlin Android Extensions in Kotin Multiplatform projects
Stars: ✭ 16 (-50%)
Mutual labels:  kotlin-native, kotlin-multiplatform
storyblok-mp-SDK
Storyblok Kotlin Multiplatform SDK (Android, JVM, JS, iOS, ...)
Stars: ✭ 16 (-50%)
Mutual labels:  kotlin-native, kotlin-multiplatform
moko-maps
Control your map from common code for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 47 (+46.88%)
Mutual labels:  kotlin-native, kotlin-multiplatform
thelema-engine
Thelema - 3D graphics engine, written in Kotlin. Based on sources of libGDX.
Stars: ✭ 51 (+59.38%)
Mutual labels:  kotlin-native, kotlin-multiplatform
kgql
GraphQL Document wrapper generator for Kotlin Multiplatform Project and Android
Stars: ✭ 54 (+68.75%)
Mutual labels:  kotlin-native, kotlin-multiplatform
kotlin-multiplatform-example
A Kotlin multiplatform example app that targets Android, ReactJS, iOS, JavaFx, and Spring Boot
Stars: ✭ 115 (+259.38%)
Mutual labels:  kotlin-native, kotlin-multiplatform
chip-8
Jetpack Compose and SwiftUI based Kotlin Multiplatform fork of https://github.com/cbeust/chip-8 (Chip-8 Emulator)
Stars: ✭ 36 (+12.5%)
Mutual labels:  kotlin-native, kotlin-multiplatform
island-time
A Kotlin Multiplatform library for working with dates and times
Stars: ✭ 69 (+115.63%)
Mutual labels:  kotlin-native, kotlin-multiplatform
moko-network
Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 107 (+234.38%)
Mutual labels:  kotlin-native, kotlin-multiplatform
koru
Simple coroutine wrappers for Kotlin Native. Generated from annotations. Compatible with RxSwift, Combine etc.
Stars: ✭ 141 (+340.63%)
Mutual labels:  kotlin-native, kotlin-multiplatform

KParser

Arithmetic Expression Parser Koltin Multi-Platform Library

Build Status Download License

Features

  • Evaluated in Degrees and Radians

  • Handle Multiple Operators

    • Minus (-)
    • Plus (+)
    • Multiply (*)
    • Division (/)
    • Power (^)
    • Exponential (E)
  • Mathematical Functions

    • Trigonometric (Sin, Cos, Tan, asin,acos,atan)
    • Hyperbolic (Sinh, Cosh, Tanh)
    • Log10,
    • ln (Natural log)
    • Log2()
    • LogX() (where X = base)
    • sqrt(Square root)
    • ! (Factorial)
    • % (Percentage)
  • Mathematical Constants

    • PI
    • e

Sample

JVM/Android

val parser = ExpressionParser()
val result = parser.evaluate("sin(PI)+1+cos(PI)")
println(result)
        
// result 0.0

C/C++

build the project with ./gradlew build

Navigate to KParser/build/bin/linux/releaseShared/

Use the generated libkparser_api.h (header file) and libkparser.so (shared object file)

#include <iostream>
#include "libkparser_api.h"

int main() {
    
    libkparser_ExportedSymbols* lib = libkparser_symbols();
    libkparser_kref_io_thelimitbreaker_ExpressionParser kparser = libkparser_kref_io_thelimitbreaker_ExpressionParser();

    double  result = lib->kotlin.root.io.thelimitbreaker.ExpressionParser.evaluate(kparser,"1+sin(PI)+cos(PI)",3);
    std::cout<<result << std::endl;
    return 0;
}

Compiling C/C++ (Command Line)

g++ main.cpp libkparser.so

Compiling C/C++ (CMake config)

Provided libkparser_api.h and libkparser.so are under folder kparser

add_library(kparser SHARED IMPORTED)
set_property(TARGET kparser PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/kparser/libkparser.so")
add_executable(PROJECT_NAME main.cpp kparser/libkparser_api.h)
target_link_libraries(${PROJECT_NAME} kparser)

Usage with Gradle(JVM/Android)

 // In root build.gradle
 repositories {
        maven {
            url  "https://dl.bintray.com/kaendagger/KParser"
        }
  }
  
  //Add in the dependencies
  dependencies{
         implementation 'io.kaen.dagger:KParser-jvm:0.1.1'
  }
    

Android App sample : Kalc-Android

Native App Sample : Kalc-Native

Work Left

  • Add usage with JS
  • Add support Windows and iOS
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].