Comments (4)
Any solution to this?
from jflap-lib.
I'm running the bundle jar file wrapped in Python code see code below for testing an input and for testing equivalence for FSAs
#this method takes an input array and a jflap FSA machine
def testInput(input, machine):#input is an array e.g. input = ["abc","aabbcc"]
from subprocess import Popen, PIPE, STDOUT
from threading import Timer
p = Popen(['java', '-jar', 'jflaplib-cli-1.3-bundle.jar', 'run', machine, input], stdout=PIPE, stderr=STDOUT)
timer = Timer(10, p.kill)
try:
timer.start()#timeout in case of infinite loops
for line in p.stdout:
return line
return 'false'
finally:
timer.cancel()
#check if one machine is equivalent to another
def checkEquivalence(machine1, machine2):
from subprocess import Popen, PIPE, STDOUT
from threading import Timer
p = Popen(['java', '-jar', 'jflaplib-cli-1.3-bundle.jar', 'equivalent', machine1, machine2], stdout=PIPE, stderr=STDOUT)
timer = Timer(10, p.kill)
checkResult = ""
try:
timer.start()
for line in p.stdout:
checkResult = line
return checkResult
finally:
timer.cancel()
from jflap-lib.
I have written a similar utility inspired by this repo, you can try it out here:
https://github.com/ushahid/jflap-cli
from jflap-lib.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jflap-lib.