473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Embedded scripting language

Hi all,

I'm writing an application that will allow users to specify their own
rules to match against certain patterns.
Initially I figured that I would offer my own interpreter (byte[14] ==
7 && byte[17] begins 'abc') but I quickly realised that I can offer
far more flexibility by offering a completely interpreted and function
rich language.
The core app is written in C# with CLR, so my two choices seem to be
Lua (linked in and interpreted at runtime) or C# (not sure how I would
call/compile this).

Has anyone else done this kind of work and what language/framework
would you recommend?

Regards
Skotl
Nov 16 '07 #1
4 1788
skotl wrote:
I'm writing an application that will allow users to specify their own
rules to match against certain patterns.
Initially I figured that I would offer my own interpreter (byte[14] ==
7 && byte[17] begins 'abc') but I quickly realised that I can offer
far more flexibility by offering a completely interpreted and function
rich language.
The core app is written in C# with CLR, so my two choices seem to be
Lua (linked in and interpreted at runtime) or C# (not sure how I would
call/compile this).

Has anyone else done this kind of work and what language/framework
would you recommend?
You can compile and load C# code when running. The necessary
classes are in the .NET framework.

A code snippet:

CodeDomProvider comp = new CSharpCodeProvider();
CompilerParameters param = new CompilerParameters();
param.GenerateInMemory = true;
param.ReferencedAssemblies.Add("System.dll");
CompilerResults res =
comp.CompileAssemblyFromSource(param, sourcecode);
Assembly asm = res.CompiledAssembly;
o = asm.CreateInstance(classname);
Arne
Nov 16 '07 #2

I'm pretty sure Fiddler has ability to create tiny plugins in
JScript.NET so you can look at that as an example. I think it
actually has a mini-IDE built in and everything.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Thu, 15 Nov 2007 17:17:32 -0800 (PST), skotl
<sc**********@elbest.netwrote:
>Hi all,

I'm writing an application that will allow users to specify their own
rules to match against certain patterns.
Initially I figured that I would offer my own interpreter (byte[14] ==
7 && byte[17] begins 'abc') but I quickly realised that I can offer
far more flexibility by offering a completely interpreted and function
rich language.
The core app is written in C# with CLR, so my two choices seem to be
Lua (linked in and interpreted at runtime) or C# (not sure how I would
call/compile this).

Has anyone else done this kind of work and what language/framework
would you recommend?

Regards
Skotl
Nov 16 '07 #3
On Nov 16, 2:22 am, Arne Vajhøj <a...@vajhoej.dkwrote:
You can compile and load C# code when running. The necessary
classes are in the .NET framework.
That's nifty - thanks Arne.

Is there a way to restrict their access to system objects / calls? (I
wonder whether this would be controlled by the number of
ReferencesAssemblies.Add() you would specifiy?).

The reason I ask is that it would be great to inherit the basic math
and string functions, as well as having Microsoft provide the
interpreter(!), but I'd not be as keen that the add-on writer could go
off and do anything he wanted to database, web services, etc.

Cheers
Scott.

Nov 16 '07 #4
skotl wrote:
On Nov 16, 2:22 am, Arne Vajhøj <a...@vajhoej.dkwrote:
>You can compile and load C# code when running. The necessary
classes are in the .NET framework.
Is there a way to restrict their access to system objects / calls? (I
wonder whether this would be controlled by the number of
ReferencesAssemblies.Add() you would specifiy?).

The reason I ask is that it would be great to inherit the basic math
and string functions, as well as having Microsoft provide the
interpreter(!), but I'd not be as keen that the add-on writer could go
off and do anything he wanted to database, web services, etc.
C# is not the right language for a such a restricted environment.

I think you will need an interpreted language instead of a compiled
..NET language.

The no assemblies trick is insufficient. mscorlib has plenty
of potential dangerous classes.

Arne
Nov 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Chris | last post by:
Hi I am posting this on both the perl and python groups My intention is not to start a war or anything else, I would just like some pragmatic advice. My apologies to the python group I am...
12
by: Brandon | last post by:
Java seems to have taken off as the platform and language of choice for many embedded devices. Would it be feasible for Python(perhaps running on an embedded version of Linux) to act in such a...
5
by: John Benson | last post by:
Regarding the message appended below: I was in a similar situation, only I had 4 "small" (RAM-wise) legacy processors in a fault-tolerant Tandem K100 system. The system came with an old Borland C++...
33
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting...
2
by: Markus Dehmann | last post by:
I'd like to process text or document templates that use "embedded C++". Here is a constructed example (the texts I have in mind are much longer and contain relatively few code blocks): ...
6
by: Roger | last post by:
......ie in my application! Basically I want to add a scripting language to a cross platform application. The prime requirements are that it is: a) Small b) May be easily staticlly compiled...
3
by: +++ | last post by:
!!!! QA ENGINEER FOR EMBEDDED SYSTEMS, OPTICAL FRONT END!!!! City: CA- San Jose Salary: Full Time- Open Job Description: Responsibilities Working in the DVD arena with Blue Lazer technology,...
0
by: da kila | last post by:
Hey people! I am looking for any scripting language, which can be used on embedded devices, like PocetPC. It doesn't have to be a complicated one. One that supports file operations should be...
0
by: Phas0r | last post by:
I have made a embedded scripting language for C++ based on XML. But the most important part is missing, calling C++ functions from within the script. I have a struct which stores all c++ commands....
20
by: Jack | last post by:
Is there a Python packaging that is specifically for embedded systems? ie, very small and configurable so the user gets to select what modules to install? For Linux-based embedded systems in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.