Title of article :
Memoizing purely functional top-down backtracking language processors
Author/Authors :
Richard L. Frost، نويسنده , , Barbara Szydlowski، نويسنده ,
Issue Information :
دوماهنامه با شماره پیاپی سال 1996
Pages :
26
From page :
263
To page :
288
Abstract :
Language processors may be implemented directly as functions. In a programming language that supports higher-order functions, large processors can be built by combining smaller components using higher-order functions corresponding to alternation and sequencing in the BNF notation of the grammar of the language to be processed. If the higher-order functions are defined to implement a top-down backtracking parsing strategy, the processors are modular and, owing to the fact that they resemble BNF notation, are easy to understand and modify. A major disadvantage of this approach is that the resulting processors have exponential time and space complexity in the worst case owing to the reapplication of processors during backtracking. This paper shows how a technique called memoization can be used to improve the efficiency of such processors whilst preserving their modularity. We show that memoized functional recognizers constructed for arbitrary non-left-recursive grammars have O(n3) complexity where n is the length of the input to be processed. The paper also shows how the initial processors could have been memoized using a monadic approach, and discusses the advantages of reengineering the definitions in this way.
Journal title :
Science of Computer Programming
Serial Year :
1996
Journal title :
Science of Computer Programming
Record number :
1079457
Link To Document :
بازگشت