Extension of Type-Based Approach to Generation of Stream-Processing Programs by Automatic Insertion of Buffering Primitives

  • Kohei Suenaga
  • Naoki Kobayashi
  • Akinori Yonezawa
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3901)


In our previous paper, we have proposed a framework for automatically translating tree-processing programs into stream-processing programs. However, in writing programs that require buffering of input data, a user has to explicitly use buffering primitives which copy data from input stream to memory or copy constructed trees from memory to an output stream. Such explicit insertion of buffering primitives is often cumbersome and worsens the readability of the program. We overcome the above-mentioned problems by developing an algorithm which, given any simply-typed tree-processing program, automatically inserts buffering primitives. The resulting program is guaranteed to be well-typed under our previous ordered-linear type system, so that the program can be further transformed into an equivalent stream-processing program using our previous framework.


Input Stream Input Tree Type Environment Output Stream Type Judgment 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bray, T., Paoli, J., Sperberg-McQueen, C.M., Maler, E.: Extensible markup language (XML) 1.0 (second edition). Technical report, World Wide Web Consortium (October 2000),
  2. 2.
    Fülöp, Z.: On attributed tree transducers. Acta Cybernetica 5, 261–280 (1981)MathSciNetzbMATHGoogle Scholar
  3. 3.
    Ganzinger, H., Giegerich, R.: Attribute coupled grammars. In: Proceedings of the ACM SIGPLAN 1984 Symposium on Compiler Construction (1984)Google Scholar
  4. 4.
    Hosoya, H., Pierce, B.C.: XDuce: A typed XML processing language. ACM Transactions on Internet Technology (TOIT) 3(2), 117–148 (2003)CrossRefGoogle Scholar
  5. 5.
    Hosoya, H., Vouillon, J., Pierce, B.C.: Regular expression types for XML. In: Proceedings of the International Conference on Functional Programming (ICFP), pp. 11–22 (September 2000)Google Scholar
  6. 6.
    Kodama, K.: Derivation of XML stream processor based on ordered linear type. Master’s thesis, Tokyo Institute of Technology (March 2005)Google Scholar
  7. 7.
    Kodama, K., Suenaga, K., Kobayashi, N.: Translation of tree-processing programs into stream-processing programs based on ordered linear type. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 41–56. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  8. 8.
    Nakano, K.: Composing stack-attributed tree transducers. Technical Report METR–2004–01, Department of Mathematical Informatics, University of Tokyo, Japan (2004)Google Scholar
  9. 9.
    Nakano, K.: An Implementation Scheme for XML Transformation Languages Through Derivation of Stream Processors. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 74–90. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  10. 10.
    Nakano, K., Nishimura, S.: Deriving event-based document transformers from tree-based specifications. In: van den Brand, M., Parigot, D. (eds.) Electronic Notes in Theoretical Computer Science, vol. 44, Elsevier Science Publishers, Amsterdam (2001)Google Scholar
  11. 11.
    Nishimura, S., Nakano, K.: XML stream transformer generation through program composition and dependency analysis. Science of Computer Programming 54, 257–290 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Polakow, J.: Ordered linear logic and applications. PhD thesis, Carnegie Mellon University, Available as Technical Report CMU-CS-01-152 (June 2001)Google Scholar
  13. 13.
    Rehof, J., Mogensen, T.: Tractable constraints in finite semilattices. Science of Computer Programming 35(2), 191–221 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Suenaga, K., Kobayashi, N., Yonezawa, A.: Extension of type-based approach to generation of stream-processing programs by automatic insertion of buffering primitives. Full paper, Available from
  15. 15.
    Benzaken, V., Castagna, G., Frisch, A.: CDuce: An XML-centric general-purpose language. In: Proceedings of the ACM International Conference on Functional Programming (2003)Google Scholar
  16. 16.
    W3C. Document Object Model (DOM) Level 1 Specification (October 1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Kohei Suenaga
    • 1
  • Naoki Kobayashi
    • 2
  • Akinori Yonezawa
    • 1
  1. 1.University of TokyoJapan
  2. 2.Tohoku UniversityJapan

Personalised recommendations