Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 1 BASIC Expression Evaluator

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 19th Oct 2016 21:47
Hi,

As part of a project I'm working on, I've had to write a string expression evaluator, based on some old C# code I used. As I develop it further and tidy it up I'll update this post.

Use it like this:



AGK doesn't have exception handling, so you'll just need to be careful and check the parserError string. Here's the code:

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Oct 2016 08:42
Nice, thanks for sharing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 3rd Nov 2016 22:25
Awesome! This parser is great! I once had a simple evaluate function that can input a string like "1=1" and return true or false.
You can code some serious stuff with a parser and an evaluator.
Thank you for sharing

[/url]
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Nov 2016 13:34
You have a list of functions it supports?

I think we did a DB challenge like this once. Took a minute but I found it. Mine was pretty basic, not sure how the other entries compares to yours. I can't test anything in DB anymore since I "upgraded" to a version that just destroyed the compatibility with everything.
http://dbcc.zimnox.com/index.php?page=view&challenge=Math%20Challenge&lang=pro

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 13th Nov 2016 23:26
I am curious how to use the function or variable marker

[/url]
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 13th Nov 2016 23:27
I am curious how to use the function or variable marker

[/url]

Login to post a reply

Server time is: 2024-11-25 01:46:47
Your offset time is: 2024-11-25 01:46:47