Dynamic Languages and Java/Domain-Specific Languages

From JVMLanguages

Table of contents

Introduction

As we discussed in Chapter 2, domain-specific programming languages are often created with one specific purpose in mind. They tend to trade flexibility for clarity, and the syntax of the language usually integrations some pre-existing concepts, functions, or data structures (that a domain expert, though not necessarily a software engineer, would recognize).

Designing the Language

Implementing the Language

Lexing and Parsing

JavaCC and ANTLR

Optimizations and Transformations

Executing the Language

Interpreting vs. Compiling

Interpreters provide an additional layer between your program and the underlying hardware of the system. In many ways this is a benefit. In particular, it allows you to more easily save the state of the interpreter at any given time.

Interpreting

Compiling

Java Integration

Writing a BSF Engine

Implementing the BSFEngine interface

Include a Languages.properties file

Writing a JSR-223 Engine