Browse > Article
http://dx.doi.org/10.9708/jksci.2014.19.2.151

Implementation of Nondeterministic Compiler Using Monad  

Byun, Sugwoo (School of Computer Science and Engineering, Kyungsung University)
Abstract
We discuss the implementation of a compiler for an imperative programming language, using monad in Haskell. This compiler involves a recursive-descent parser conducting nondeterministic parsing, in which backtracking occurs to try with other rules when the application of a production rule fails to parse an input string. Haskell has some strong facilities for parsing. Its algebraic types represent abstract syntax trees in a smooth way, and program codes by monad parsing are so concise that they are highly readable and code size is reduced significantly, comparing with other languages. We also deal with the runtime environment of the assembler and code generation whose target is the Stack-Assembly language based on a stack machine.
Keywords
Haskell; Monad; Parser Monad; nondeterministic Parsing; Stack Machine;
Citations & Related Records
연도 인용수 순위
  • Reference
1 Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman, "Compilers: Principles, Techniques, and Tools," (2nd edition) Addison Wesley, September 2006.
2 Graham Hutton and Erik Meijer, "Monadic Parser Combinators," Journal of Functional Programming, Vol. 8, Number 4, pp 437-444, Cambridge University Press, July 1998.   DOI   ScienceOn
3 Graham Hutton, "Programming in Haskell," Cambridge University Press, 2007.
4 Sugwoo Byun, "Development of an Assembly Language Interpreter Using Monad," Software and Applications: Journal of Korean Institute of Information Scientists and Engineers, vol. 27, Number 5, pp. 403-410, May 2010.
5 Kiyoung Ahn and Jeonghoon Park, "Learing Functional Programming in Haskell," Daelim-Press, 2009. (Korean-translated version of [2]).
6 Simon Thompson, "Haskell: The Craft of Functional Programming," (third edition), Addison Wesley Professional, 2011.
7 Philip Wadler, "Comprehending Monads," Proceedings of the 1990 ACM Conference on Lisp and Functional Programming Languages. 1990.
8 Haskell Homepage. http://haskell.org.
9 Commercial Users of Functional Prog., http:// cufp.org.
10 Eugin Moggi, "Computational lambda-calculus and monads," IEEE Symposium on Logic in Computer Science, June 1989.
11 Haskell Understanding Monads, (http://en.wikibooks.org/wiki/Haskell/Understanding_mo nads)
12 Scala Homepage, http://www.scala-lang.org