This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes custom interpreted language or full blown python language Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "custom interpreted language or full blown python language" Watch "custom interpreted language or full blown python language" New topic

custom interpreted language or full blown python language

Avi Dixit

Joined: Jun 13, 2012
Posts: 10

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.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14961

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).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: custom interpreted language or full blown python language
It's not a secret anymore!