{"title":"Concrete syntax for data objects in functional languages","authors":"Annika Aasa, Kent Petersson, Dan Synek","doi":"10.1145/62678.62688","DOIUrl":null,"url":null,"abstract":"Many functional languages have a construction to define inductive data types [Hoa75] (also called general :structured types [Pey87], structures [Lan64], datatypes [Mil84] and free algebras [GTWW77]). An inductive defin.ition of a data type can also be seen as a grammar for at language and the elements of the data type as the phrases of the language. So defining an inductive data type can be seen as introducing an embedded language of values into the programming language. This correspondence is however not fully exploited in existing functional languages. The elements can presently only be written in a very restricted form. They are just the parse trees of the elements written in prefix form. A generalization, that we will consider in this paper, is to allow the elements to be written in a more general form. Instead of directly writing the parse trees of the embedded language, we would like to use a more concrete syntactical form and let an automatically generated parser translate the concrete syntactical form to the corresponding parse tree. We think that this is especi.ally useful when we manipulate languages in programs, for example, when implementing compilers, interpreters, program transformation systems, and programming logics. It is also convenient if we want to use the concrete syntax for other kinds of data in a program.","PeriodicalId":119710,"journal":{"name":"Proceedings of the 1988 ACM conference on LISP and functional programming","volume":"2 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1988-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"27","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 1988 ACM conference on LISP and functional programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/62678.62688","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 27
Abstract
Many functional languages have a construction to define inductive data types [Hoa75] (also called general :structured types [Pey87], structures [Lan64], datatypes [Mil84] and free algebras [GTWW77]). An inductive defin.ition of a data type can also be seen as a grammar for at language and the elements of the data type as the phrases of the language. So defining an inductive data type can be seen as introducing an embedded language of values into the programming language. This correspondence is however not fully exploited in existing functional languages. The elements can presently only be written in a very restricted form. They are just the parse trees of the elements written in prefix form. A generalization, that we will consider in this paper, is to allow the elements to be written in a more general form. Instead of directly writing the parse trees of the embedded language, we would like to use a more concrete syntactical form and let an automatically generated parser translate the concrete syntactical form to the corresponding parse tree. We think that this is especi.ally useful when we manipulate languages in programs, for example, when implementing compilers, interpreters, program transformation systems, and programming logics. It is also convenient if we want to use the concrete syntax for other kinds of data in a program.