I hasn't been a very productive weekend; however I created a pydsl tutorial session I'd like to explain:

from pydsl.Config import GLOBALCONFIG
from pydsl.Memory.Search.Searcher import MemorySearcher
from pydsl.Memory.Search.Indexer import Indexer
from pydsl.Memory.Loader import load_function
from pydsl.Guess import Guesser

mystring = "True||False"
guesser = Guesser()

grammarlist = guesser(mystring)

>  {'IntegerTree', 'cstring', 'unixPathTreeGrammar', 'LogicalExpression'}

assert("LogicalExpression" in grammarlist)
searcher = MemorySearcher([Indexer(x) for x in GLOBALCONFIG.memorylist])
availabletransformers = [x['identifier'] for x in searcher.search({'inputlist':{'$in':'LogicalExpression'}})]


solver = load_function('logicalSolver')
result = solver({'input':mystring})

> True 
  • the imports lines load the required elements from pydsl
  • mystring is the input string
  • guesser generates a list of grammar definitions that accepts the input string
  • searcher searchs the memory
  • availabletransformers is a list of transformers that have the selected grammar (LogicalExpression) as an input
  • solver is a function that performs the translation
  • and result is the output
This program should return "True", although the logicalSolver pydsl_contrib implementation won't be ready until the Syntax Directed Translator is merged into master.