Hostname: page-component-848d4c4894-mwx4w Total loading time: 0 Render date: 2024-06-27T04:50:10.643Z Has data issue: false hasContentIssue false

Translation of tree-processing programs into stream-processing programs based on ordered linear type1

Published online by Cambridge University Press:  01 May 2008

KOICHI KODAMA
Affiliation:
Tokyo Institute of Technology
KOHEI SUENAGA
Affiliation:
University of Tokyo (e-mail: kohei@yl.is.s.u_tokyo.ac.jp)
NAOKI KOBAYASHI
Affiliation:
Tohoku University
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

There are two ways to write a program for manipulating tree-structured data such as XML documents: One is to write a tree-processing program focusing on the logical structure of the data and the other is to write a stream-processing program focusing on the physical structure. While tree-processing programs are easier to write than stream-processing programs, tree-processing programs are less efficient in memory usage since they use trees as intermediate data. Our aim is to establish a method for automatically translating a tree-processing program to a stream-processing one in order to take the best of both worlds. We first define a programming language for processing binary trees and a type system based on ordered linear type, and show that every well-typed program can be translated to an equivalent stream-processing program. We then extend the language and the type system to deal with XML documents. We have implemented an XML stream processor generator based on our algorithm, and obtained promising experimental results.

Type
Articles
Copyright
Copyright © Cambridge University Press 2008

References

Aho, A. V., Sethi, R. & Ullman, J. D. (1986) Compilers. Boston, MA: Addison-Wesley.Google Scholar
Avila-Campillo, I.Green, T. J.Gupta, A.Onizuka, M.Raven, D. & Suciu, D. (2002) October XMLTK: An XML toolkit for scalable XML stream processing. In Proceedings of PLAN-X.Google Scholar
Baker, H. G. (1992) Lively Linear Lisp—Look Ma, No Garbage! ACM SIGPLAN notices, 27 (8), 8998.CrossRefGoogle Scholar
Bar-Yossef, Z.Fontoura, M., & Josifovski, V. (2005) Buffering in query evaluation over XML streams. In Proceedings of the 24th ACM SIGMOD-SIGACT-SIGART Symposium on Priciples of Database Systems (PODS2005) pp. 216–227.CrossRefGoogle Scholar
Benzaken, V., Castagna, G. & Frisch, A. (2003 August) CDuce: An XML-centric general-purpose language. In Proceedings of 8th ACM SIGPLAN International Conference on Functional Programming (ICFP 2003). New York: ACM Press, pp. 5163.Google Scholar
Berglund, A., Boag, S., Chamberlin, D., Fernández, M. F., Kay, M., Robie, J. & Simeon, J. (2003 November). XML path language (XPath) 2.0. World Wide Web Consortium. Available at: http://www.w3.org/TR/xpath20/. Accessed 29 November 2007.Google Scholar
Boag, S., Chamberlin, D., Fernández, M. F., Florescu, D., Robie, J. & Siméon, J. (2003 November) XQuery 1.0: An XML Query Language. World Wide Web Consortium. http://www.w3.org/TR/xquery/. Accessed 29 November 2007.Google Scholar
Bray, T., Paoli, J.Sperberg-McQueen, C. M. & Maler, E. (2000 October). Extensible Markup Language (XML) 1.0, 2nd ed. Tech. rept. World Wide Web Consortium. Available at: http://www.w3.org/TR/REC-xml. Accessed 29 November 2007.Google Scholar
Chamberlin, D., Frankhauser, P., Marchiori, M. & Robie, J. (2003 November) XML query (XQuery) requirements. World Wide Web Consortium. Available at: http://www.w3.org/TR/xquery-requirements/. Accessed 29 November 2007.Google Scholar
DataPower Technology, Inc. (2001 March) XSLTMark. Available at: http://www.datapower.com/xmldev/xsltmark.html. Accessed 2 November 2005.Google Scholar
Ganzinger, H. & Giegerich, R. (1984) Attribute coupled grammars. In Proceedings of the ACM SIGPLAN '84 Symposium on Compiler Construction. New York: ACM Press, pp. 157170.Google Scholar
Green, T., Onizuka, M. & Suciu, D. (2001) Processing XML Streams With Deterministic Automata and Stream Indexes. Tech. rept. Seattle, WA: University of Washington.Google Scholar
Gupta, A. K. & Suciu, D. (2003 June) Stream processing of XPath queries with predicates. In Proceedings of the 2003 ACM SIGMOD International Conference on Management of Data. New York: ACM Press, pp. 419–30.CrossRefGoogle Scholar
Hosoya, H. & Pierce, B. C. (2003). XDuce: A typed XML processing language. ACM Trans. Internet Technol. (TOIT) 3 (2), 117148.CrossRefGoogle Scholar
Igarashi, A. & Kobayashi, N. (2002) Resource usage analysis. In Proceedings of ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. New York: ACM Press, pp. 331342.Google Scholar
Koch, C. & Scherzinger, S. (2003 September). Attribute grammars for scalable query processing on XML streams. In Proceedings of the 9th International Conference on Data Base Programming Language (DBPL). New York: Springer-Verlag, pp. 233–56.Google Scholar
Ludäscher, B.Mukhopadhyay, P. & Papakonstantinou, Y. (2002) A Transducer-based XML query processor. Proceedings of the 28th International Conference on Very Large Data Bases. Franklin County, Ohio: VLDB Endowment Inc, pp. 227–38.Google Scholar
Meijer, E., Fokkinga, M. & Paterson, R. (1991) Functional programming with bananas, lenses, envelopes and barbed wire. In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture. New York: Springer-Verlag, pp. 124144.Google Scholar
Nakano, K. (2004). Composing Stack-Attributed Tree Transducers. Tech. rept. METR–2004–01. Department of Mathematical Informatics, University of Tokyo, Japan.Google Scholar
Nakano, K. & Mu, S.-C. (2006) A pushdown machine for recursive XML processing. In Proceedings of the 4th ASIAN Symposium on Programming Languages and Systems (APLAS2006). New York: Springer-Verlag, pp. 340–56.CrossRefGoogle Scholar
Nakano, K. & Nishimura, S. (2001). Deriving event-based document transformers from tree-based specifications. Electron. Notes Theor. Comput. Sci. 44 (2), 181205.CrossRefGoogle Scholar
Neven, F. (2005) Attribute grammars for unranked trees as a query language for structured documents. J. Comput. Syst. Sci. 70 (2), 221257.CrossRefGoogle Scholar
Olteanu, D., Meuss, H., Furche, T. & François, (2002) XPath: Looking forward. In Proceedings of the EDBT Workshop on XML Data Management (XMLDM). pp. 109–127.CrossRefGoogle Scholar
Petersen, L., Harper, R., Crary, K. & Pfenning, F. (2003) A type theory for memory allocation and data layout. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. New York: ACM, pp. 172–84.CrossRefGoogle Scholar
Polakow, J. (2001 June) Ordered Linear Logic and Applications. Ph.D. thesis. Carnegie Mellon University. Available as Technical Report CMU-CS-01-152.Google Scholar
Sato, S. (2007 March). Automatic Insertion of Buffering Primitives for Generating XML Stream Processor (in Japanese). M.Phil. thesis. Japan: Tohoku University.Google Scholar
Scardina, M. & Fernandez, M. (2003 August) XPath Requirements Version 2.0. World Wide Web Consortium. Available at: http://www.w3.org/TR/xpath20req/. Accessed 29 November 2007.Google Scholar
Schmidt, A. R., Waas, F., Kersten, M. L., Florescu, D., Manolescu, I.Carey, M. J. & Busse, R. (2001 April) The XML Benchmark Project. Tech. rept. Centrum voor Wiskunde en Informatica.Google Scholar
Suenaga, K., Kobayashi, N. & Yonezawa, A. (2005 September) Extension of type-based approach to generation of stream-processing programs by automatic insertion of buffering primitives. In International Symposium on Logic-based Program Synthesis and Translformation (LOPSTR 2005). New York: Springer-Verlag, pp. 98114.Google Scholar
Turner, D. N., Wadler, P. & Mossin, C. (1995) Once upon A type. In Proceedings of Functional Programming Languages and Computer Architecture. New York: Springer-Verlag, pp. 111.Google Scholar
Wadler, P. (1988) Deforestation: Transforming programs to eliminate trees. In ESOP '88. European Symposium on Programming, Nancy, France, Lecture Notes in Computer Science, vol. 300. Berlin: Springer-Verlag, pp. 344358.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.