Here is a list of definitions for pydsl:
  • Lexer(grammar definition, input) -> TokenList (using yield)
  • ASTTranslator(AST definition, input) -> ASTree
Those function/classes are used to archive the DSL workflow:

 Lexer -> Parser -> ASTTranslator (Frontend) -> Interpreter/Output/Bytecode (Backend)  
Any sugestions about the signatures?

Update on 13/7/2012


Here is a more detailed list of abstractions implemented in pydsl
  • Checker(grammar definition , input) -> bool checks if input is a valid word according to grammar definition
    Checkers are functions that receive a grammar specification and any kind of data, and return True or False


    checker -> grammar_spec -> data -> bool


    In a more pythonic way:

        class Checker:
            def __init__(self, grammarspec):
                self.grammarspec = grammarspec
            def check (self, data):
                .....
                return True
        
    right now there are implementations available for regular expressions and BNF grammars. This function/class belongs to the grammar tools family:

    • Checker
    • Lexer
    • Parser

    that are the most basic functions for grammars.
  • Parser(grammar definition, input) -> ParseTree
    •  generates a ParseTree from input 
  • Lexer(grammar definition, input) -> TokenList (using yield)
    • yields tokens from the input
  • Distance(grammar definition, input1, input2) -> int
    • Returns the distance between two inputs according to the grammar 
  • GetGroup (grammar definition, input, groupname) -> TokenList
    • locates locates a group of elements within the input
  • Validator(grammar definition, input) -> TokenList
    • returns a list of invalid token and the nearest alternative
  • Function
    • Standard function
      • Function(function definition, input) -> output
    • Dictionary function Interface
      • Function(function definition, dict) -> outputdict
    • Conversation function Interface
      • Function(workingmemory, function definition, input) -> output 
  • ASTTranslator(AST definition, input) -> ASTree

Update on 25/8/2012


Here is a more detailed list of abstractions implemented in pydsl
  • First(grammar definition) -> returns a set with every possible  starting element
  • Guesser(data, memory -> grammarlist 
    • returns the list of grammars that accepts the input data 
  • Availableactions(data, memory) -> functionlist
    • returns a list of functions available for conforming grammars
  • Validate(grammar definition, input) -> TokenList
    • returns a list of invalid token and the nearest alternative 
  • Extract(grammar definition, input) -> Tokenlist 
    • returns a list of segments (tokens) that are accepted words