• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

custom interpreted language or full blown python language

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am a Basic java user. I want to create an application where I want to give user a chance to plugin its own calculations. Now users won't be expert in any language.

I need to do the following
1. Give access to the variables for user to use
2. run user defined script to calculate an output variable and use it further. User run scripts will be very simple ones. like simple if functions, for functions. they won't be full blown Object oriented language.

I want to be able to have at least a basic check on the syntax that user is using.

Please give me some direction so that I can implement this. What you guys think would be the best way to do this

Whats your opinion about using Jython, can it be done. I know there is "antlr" but I am thinking of easiest way to do it.

Sorry if my question is not clear, its kind of hard to frame it exactly the right way.

regards,
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java has a scripting API; look at the documentation for the package javax.script. By default it comes at least with an interpreter for JavaScript, and you can plug in scripting engines for other languages. There's no need to build your own parser etc. (unless you really want to invent your own little language).
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic