Uses 419K of libraries. Click here for Pure Java version (99L/1K/4K).
!752 !1002813 // gnu prolog import gnu.prolog.vm.*; import gnu.prolog.term.*; import gnu.prolog.database.*; static int query(Interpreter intp, Term term) ctex { try { Interpreter.Goal goal = intp.prepareGoal(term); ret intp.execute(goal); // todo: stop goal? } catch (Exception e) { print("fail " + e); ret 0; } } p { new Environment env; S streamName = "someinput"; Reader reader = new StringReader("here."); new PrologTextLoader(env.getPrologTextLoaderState(), reader, streamName); List<PrologTextLoaderError> errors = env.getLoadingErrors(); for (PrologTextLoaderError error : errors) { printStackTrace(error); } Interpreter interpreter = env.createInterpreter(); env.runInitialization(interpreter); //print(interpreter.runOnce(AtomTerm.get("here"))); //print(interpreter.runOnce(AtomTerm.get("there"))); print(query(interpreter, AtomTerm.get("true"))); print(query(interpreter, AtomTerm.get("there"))); print(query(interpreter, AtomTerm.get("here"))); }
Began life as a copy of #1002814
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
1212 | stefan | Ok, KINDA works... | 2016-02-27 01:50:51 |
Snippet ID: | #1002815 |
Snippet name: | GNU Prolog Test 2 (loading text) |
Eternal ID of this version: | #1002815/1 |
Text MD5: | e87edd51ec87a42405a593bcefd6b89f |
Transpilation MD5: | b9157e4b71db63b8f3a43e977ef4e27c |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-27 01:50:26 |
Source code size: | 1063 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 852 / 1046 |
Referenced in: | [show references] |