The latest version of ANTLR provides the tools you need to build a parser for special-purpose languages.
by Rod Coffin and Paul Holser
November 12, 2007
he concept of Domain-Specific Languages (DSLs) has been around for years, but has recently experienced an uptick in popularity. This is due in large part to the success of Ruby on Rails, which exploits the Ruby programming language and its meta-programming capabilities to encourage the development of programs that closely mirror the domains they model. This style of DSL is sometimes called an internal DSL because it uses available constructs from the programming language itself to create code that reads in a manner similar to the underlying domain. Here are a couple of examples of internal DSLs:
// Ruby - Active Record for Object Relational Mapping
class Book < ActiveRecord::Base
belongs_to :category
has_many :chapters
end
// Java - Using JUnit 4.4 for verifying unit test assertions
assertThat(list, hasItems("foo", "bar", "baz"));
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!