Script Engine

  • Thread starter Thread starter Hardy Wang
  • Start date Start date
H

Hardy Wang

Hi all,

Anybody knows where can I find some information about script engine theory?

I have the requirement:
Our product has some template files, and there placeholder/variabled
embedded inside template (like %CurrentTime%, %HoursRemaining% and so on).
There are also some other variables (like %Coupon%) whose value is based on
values of other variables.
For example
if (%HoursRemaining% < 5) {
%Coupon% = "Hello 1";
} else if (%HoursRemaining% < 10) {
%Coupon% = "Hello 2";
} else {
%Coupon% = "";
}

What we need is to build some generic solution to handle this type of
requirements, what I am thinking is to create some type of very simple
script to embed inside template.

So my question is, where can I start to build my script engine? Any
reference/sample I can look?
 
Hardy Wang napisal(a):
Hi all,

Anybody knows where can I find some information about script engine theory?

I have never heard of "script engine theory" but from what you've
written you need to know something about parsing theory. While the
topic, in its full extent, is quite tricky and requires a lot of
math/CS knowledge, your requirement is simple enough that you should
get away with just a good tool
I have the requirement:
Our product has some template files, and there placeholder/variabled
embedded inside template (like %CurrentTime%, %HoursRemaining% and so on).
There are also some other variables (like %Coupon%) whose value is based on
values of other variables.
For example
if (%HoursRemaining% < 5) {
%Coupon% = "Hello 1";
} else if (%HoursRemaining% < 10) {
%Coupon% = "Hello 2";
} else {
%Coupon% = "";
}

What we need is to build some generic solution to handle this type of
requirements, what I am thinking is to create some type of very simple
script to embed inside template.

So my question is, where can I start to build my script engine? Any
reference/sample I can look?

I'd recommend AntLr: http://www.antlr.org/ . It's been stable for quite
a long time, it also generates C# code, and in my opinion has gentle
learning curve. Read the docs, give yourself a minute of thinking and
go on. Good luck
 
Back
Top