PDF Ebook A Programming Language Where the Syntax and Semantics Are Mutable at Runtime
Katahdin is a programming language where the syntax and semantics are mutable at runtime. The Katahdin interpreter parses and executes programs according to a language definition that can be modified by the running program. Commands to modify the language definition are similar to those that define new types and functions in other languages, and can be collected into language definition modules.
Katahdin can execute programs written in any language which it has a definition module for. The definition of more than one language can be composed allowing more than one language to be used in the same program, the same file, and even the same function. Data and code is shared between all languages, with a function defined in one language callable from another with no binding layer. Traditional language development involves using a parser generator tool to generate a static parser from the language grammar. Katahdin’s approach is to just-in-time compile a parser from the grammar as the program runs. The grammar can be modified as the program runs because the parser can be recompiled to match it.
Recent research into grammar theory with parsing expression grammars and parser theory with packrat parsers provided the basis for the techniques used in Katahdin and will be referenced in this thesis along with an introduction to my additions.
Katahdin is intended as a language independent interpreter and a development platform that can replace traditional static parser generators for language development. With further development Katahdin should be useable as a drop in replacement for interpreters and compilers for a wide range of languages, and as a platform for development of new languages.
Using a single runtime to execute any programming language will reduce development costs to businesses. For any combination of languages used in a system, only a single runtime has to be maintained, ported between platforms and supported. The ability to use multiple languages in the same program will allow businesses to use the most appropriate language for any part of thesystem. For example, an engineer could write the core of a program in FOR TRAN and then add a user interface written in Python, without worrying about interfacing between two runtimes.
CONTENTS
Summary
Achievements
Table of Contents
List of Figures
Acknowledgements
- 1 Background
- 1.1 Programming Languages
1.2 The Advantages of Kathadin’s Approach
1.2.1 A Single Runtime
1.2.2 Language Interoperability
1.2.3 A New Concept of Languages
1.3 Theory Background
- 1.3.1 Grammars
1.3.2 Parsing
1.3.3 Semantics
1.4 Applied Theory
- 1.4.1 Parsing Expression Grammars
1.4.2 Packrat Parsing
2 Technical Basis
- 2.1 The Katahdin Language
- 2.1.1 Design
2.1.2 Implementation
2.2 Grammar
- 2.2.1 Annotations
2.2.2 Expressing Recursion
2.2.3 Expressing Precedence
2.2.4 Expressing Lexemes and White-Space
2.2.5 Building Parse Trees
2.3 Semantics
2.4 Parsing
- 2.4.1 Parsing Recursion
2.4.2 Parsing Precedence
3 Design and Implementation
- 3.1 Prototyping
3.2 Platform
- 3.2.1 Platform Options
3.2.2 Version Control
3.3 Implementation
3.4 Implementation of the Language
3.5 Implementation of the Parser
3.5.1 Compiling the Parser
3.6 Implementation of the Debugger
3.7 File Handling
3.8 Standard Library
3.9 Language Modules
3.10 Testing
4 Current Status and Future Plans
- 4.1 State of Implementation
4.2 Unsolved Problems
- 4.2.1 Memory Consumption
4.2.2 Speed
4.2.3 Error Handling
4.3 Future Development
- 4.3.1 Debugger
4.3.2 Language Modules
4.4 Conclusion
Bibliography
Download
PDF Ebook A Programming Language Where the Syntax and Semantics Are Mutable at Runtime
Posted in :