{"title":"LAM: another Prolog abstract machine","authors":"X. Li, Y. Yao","doi":"10.1109/CCECE.1996.548099","DOIUrl":null,"url":null,"abstract":"The Warren Abstract Machine has been accepted as the de facto standard for implementing Prolog for more than ten years. The WAM adopts structure copying to represent Prolog terms. It flattens nested structures and expands them into efficient WAM instructions which either copy terms into the heap or unify terms along the heap pointer. When two terms to be unified are structure instances in the heap, the WAM must invoke a built-in procedure to carry out the stack based full unification. We propose a new Prolog execution model-the Lakehead Abstract Machine. The LAM is designed to retain the control features of the WAM, but the structure copying is replaced by program sharing for implementing unification. The idea of program sharing is originated from the structure sharing used in the DEC-10 Prolog. The significant difference, however, is that the shared resources are no longer structure prototypes, but executable LAM code. With the LAM, nested structures are flattened and then translated into a set of subprograms. In constructing a structure, the LAM only puts its corresponding subprogram pointer into the heap. When two terms to be unified are structures, their bound subprograms will be invoked. We have implemented an experimental LAM emulator in C. Benchmarks show that the LAM based Prolog implementation is quite competitive with the WAM based systems, such as SICStus and BIN-Prolog.","PeriodicalId":269440,"journal":{"name":"Proceedings of 1996 Canadian Conference on Electrical and Computer Engineering","volume":"52 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1996-05-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of 1996 Canadian Conference on Electrical and Computer Engineering","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/CCECE.1996.548099","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
The Warren Abstract Machine has been accepted as the de facto standard for implementing Prolog for more than ten years. The WAM adopts structure copying to represent Prolog terms. It flattens nested structures and expands them into efficient WAM instructions which either copy terms into the heap or unify terms along the heap pointer. When two terms to be unified are structure instances in the heap, the WAM must invoke a built-in procedure to carry out the stack based full unification. We propose a new Prolog execution model-the Lakehead Abstract Machine. The LAM is designed to retain the control features of the WAM, but the structure copying is replaced by program sharing for implementing unification. The idea of program sharing is originated from the structure sharing used in the DEC-10 Prolog. The significant difference, however, is that the shared resources are no longer structure prototypes, but executable LAM code. With the LAM, nested structures are flattened and then translated into a set of subprograms. In constructing a structure, the LAM only puts its corresponding subprogram pointer into the heap. When two terms to be unified are structures, their bound subprograms will be invoked. We have implemented an experimental LAM emulator in C. Benchmarks show that the LAM based Prolog implementation is quite competitive with the WAM based systems, such as SICStus and BIN-Prolog.