VisualLangLab

VisualLangLab
Developer(s) Sanjay Dasgupta
Stable release 7.xx
Platform Scala 2.9+
Type parser/scanner generator
License GPL
Website http://vll.java.net/

VisualLangLab (Visual Language Laboratory) is a completely visual, open source parser generator for JVM (Java Virtual Machine) languages. VisualLangLab allows users to create, edit and test graphical grammar-trees that represent grammar rules, without any textual (BNF, EBNF, ABNF, etc.) grammar specification. VisualLangLab was The Java Posse's Project of the Week[1] for episode 364.

A Quick Tour[2] and Rapid Prototyping for Scala[3] are tutorials that use examples from other sources. An introductory article, Grammar without Tears[4] is available online.

Ease of Use

VisualLangLab provides a graphical user interface (GUI).[5] This interactive IDE (Integrated Development Environment)-style interface[5] differentiates it from other parser generators. The grammar-trees are executable, and can be test-run[6] at the click of a GUI button. Parsers can be created[7] and tested[6] entirely within the user interface without additional tools or skills. Because of its ease of use, VisualLangLab is an effective prototyping and training environment. It also allows the use of semantic actions[clarification needed] (written as Scala or Javascript functions) embedded within the grammar[8] where needed. A comment on lambda-the-ultimate[9] in October 2004 describes VisualLangLab as a Yacc with a GUI.

↑Jump back a section

Grammar as Visual Tree

Most other parser generators for Java (e.g. JavaCC, ANTLR) use a textual grammar specification in Extended Backus-Naur Form (EBNF) or Parsing expression grammar (PEG). However, unlike them, the VisualLangLab instead creates a visual grammar of the language, using its GUI.

VisualLangLab's grammar-trees are equivalent to PEGs; they support sequences, ordered choices, multiplicities (*, +, ?), as well as syntactic and semantic predicates.[7] These grammar-trees are turned directly into instances of Scala's Parser type[10] at run-time.[11] The grammar-trees and other GUI[5] features are intuitive, and the user does not have to understand PEGs or Scala programming, but familiarity with Scala's standard data types[12] is useful in understanding the abstract syntax tree (AST).[13]

↑Jump back a section

Capabilities

VisualLangLab generates backtracking recursive descent parsers based on Scala's parser combinator library.[14]

VisualLangLab's parsers successfully handle the LL(*) class of grammars, and can also handle optional left-recursion by using packrat parsers. These are possible because of the underlying Scala parser combinator support.[14]

↑Jump back a section

Built-in Lexer

VisualLangLab uses an internal lexical analyzer that[15] is an improvement over the mechanism used in Scala's native RegexParsers.[16] VisualLangLab includes a mechanism that automatically defines and creates an AST for all grammars.[13] VisualLangLab is licensed under a GPL license.

↑Jump back a section

Grammar Reuse

Parsers created in VisualLangLab can be saved as XML (eXtensible Markup Language) files that can be reopened later for review, further editing or testing.

↑Jump back a section

API

An API[17] (Application Programming Interface) enables host programs to open the XML files and regenerate the parser. Starting with version 6.01 (which optionally provides ASTs created with basic JVM types only), host programs may be written in any JVM language. This feature makes VisualLangLab's parsers available to all JVM languages (present and future).

↑Jump back a section

History

VisualLangLab was created on 5 March 2004 as A Visual LL(K) Parser Generator. This first version was written in Java, and can still be found at the Older version website. The software was usable by mid-2004, and an interesting application is described in this java.net article published in early October 2004. A comment on lambda-the-ultimate[9] in October 2004 describes VisualLangLab as a Yacc with a GUI. The availability of Scala and its built-in parser-combinators prompted a re-write, and a Scala version was published at the current Official VisualLangLab website on 10 March 2010. Although all of the code was re-written in Scala, the essential character of the GUI remains the same. A news item[18] on jaxenter featured this version in late March 2010.

The Grammar without Tears[4] article was featured in the java.net Editor's blog[19] on 14 September 2011.

In September 2011 VisualLangLab was The Java Posse's Project of the week[1]

A pure Java version[20] with a much smaller download size was previewed in early January 2012.

↑Jump back a section

References

  1. ^ a b Java Posse Episode 364 VisualLangLab is Project of the week!
  2. ^ A Quick Tour uses examples from the book The Definitive ANTLR Reference
  3. ^ Rapid Prototyping for Scala uses example from the book Programming Scala
  4. ^ a b GWT Article Grammar without Tears article on java.net
  5. ^ a b c GUI VisualLangLab's graphical user interface
  6. ^ a b Testing Testing the Grammar
  7. ^ a b Editing Editing the Grammar
  8. ^ ActionCode Action Code Design
  9. ^ a b lambda-the-ultimate Yacc with a GUI
  10. ^ Parser Scala's scala.util.parsing.combinator.Parsers#Parser class
  11. ^ Scala Relationship VisualLangLab's Relationship with Scala
  12. ^ Scala API Scala's standard data types
  13. ^ a b AST VisualLangLab's AST Structure
  14. ^ a b Scala parser combinator Scala's parser combinator library
  15. ^ Internal Lexer VisualLangLab's internal lexical analyzer
  16. ^ RegexParsers Scala's scala.util.parsing.combinator.RegexParsers class
  17. ^ API VisualLangLab's API
  18. ^ News-item on jaxenter Scala's Parser Combinators in a Visual Environment
  19. ^ java.net Editor's blog New Article: Introduction to java.net's VisualLangLab Project
  20. ^ Pure Java version A preview of the pure Java version
↑Jump back a section
Last modified on 31 October 2012, at 04:07