PSOA-to-TPTP Converter Documentation

Similar documents
PSOA2TPTP: A Reference Translator for Interoperating PSOA RuleML with TPTP Reasoners

PSOATransRun: Translating and Running PSOA RuleML via the TPTP Interchange Language for Theorem Provers

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria

PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes

CMSC 330: Organization of Programming Languages. Context Free Grammars

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

CSE 12 Abstract Syntax Trees

CSE450 Translation of Programming Languages. Lecture 4: Syntax Analysis

A New Model Checking Tool

Parsing CSCI-400. Principles of Programming Languages.

Lecture 4: Syntax Specification

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

Syntax. A. Bellaachia Page: 1

Design and Implementation of a Java to CodeML converter

22c:111 Programming Language Concepts. Fall Syntax III

Better Extensibility through Modular Syntax. Robert Grimm New York University

Semantic Analysis. Lecture 9. February 7, 2018

Building Compilers with Phoenix

Building Compilers with Phoenix

Index. Comma-separated values (CSV), 30 Conditional expression, 16 Continuous integration (CI), 34 35, 41 Conway s Law, 75 CurrencyPair class,

Formal Semantics. Prof. Clarkson Fall Today s music: Down to Earth by Peter Gabriel from the WALL-E soundtrack

Introduction to Lexing and Parsing

CSE 3302 Programming Languages Lecture 2: Syntax

UNIT I Programming Language Syntax and semantics. Kainjan Sanghavi

Group B Assignment 9. Code generation using DAG. Title of Assignment: Problem Definition: Code generation using DAG / labeled tree.

Comp 411 Principles of Programming Languages Lecture 3 Parsing. Corky Cartwright January 11, 2019

COP 3402 Systems Software Syntax Analysis (Parser)

Theoretical Part. Chapter one:- - What are the Phases of compiler? Answer:

The Substitution Model

Syntax and Grammars 1 / 21

The Structure of a Syntax-Directed Compiler

Program Analysis ( 软件源代码分析技术 ) ZHENG LI ( 李征 )

Object-oriented Compiler Construction

Domain-Specific. Languages. Martin Fowler. AAddison-Wesley. Sydney Tokyo. With Rebecca Parsons

PSOA2Prolog: Object-Relational Rule Interoperation and Implementation by Translation from PSOA RuleML to ISO Prolog

CPS 506 Comparative Programming Languages. Syntax Specification

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

Programming Languages & Translators PARSING. Baishakhi Ray. Fall These slides are motivated from Prof. Alex Aiken: Compilers (Stanford)

Compiling Regular Expressions COMP360

MPLc Documentation. Tomi Karlstedt & Jari-Matti Mäkelä

CS152: Programming Languages. Lecture 2 Syntax. Dan Grossman Spring 2011

Language engineering and Domain Specific Languages

Free Downloads The Definitive ANTLR 4 Reference

COP 3402 Systems Software Top Down Parsing (Recursive Descent)

Types and Static Type Checking (Introducing Micro-Haskell)

Compiler Design Overview. Compiler Design 1

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

UPTR - a simple parse tree representation format

Lexical Scanning COMP360

Transition from EBNF to Xtext

Lecture 10 Parsing 10.1

EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing. Görel Hedin Revised:

List of Figures. About the Authors. Acknowledgments

What do Compilers Produce?

programming languages need to be precise a regular expression is one of the following: tokens are the building blocks of programs

Principles of Programming Languages COMP251: Syntax and Grammars

JASMINT: Language to User-Friendly AST with Emphasis on Transpilation. By: John Bradbury. Advisor: John Clements. Computer Science Department

Syntax. In Text: Chapter 3

Possibility of SystemC code generation from SDL specication

Inside PHP Tom OSCON th July, 2012

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

CMSC 330: Organization of Programming Languages. Context Free Grammars

Technical aspects of VTL to SQL translation Prepared by Regional Statistical Office in Olsztyn, Poland

The Structure of a Compiler

Writing a Simple DSL Compiler with Delphi. Primož Gabrijelčič / primoz.gabrijelcic.org

Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT

The Substitution Model. Nate Foster Spring 2018

Modules, Structs, Hashes, and Operational Semantics

Crafting a Compiler with C (II) Compiler V. S. Interpreter

The design of the PowerTools engine. The basics

CMSC 330: Organization of Programming Languages

Chapter 4. Abstract Syntax

Automatic Parallelization of Sequential C Code

Chapter 3: CONTEXT-FREE GRAMMARS AND PARSING Part 1

Informatica 3 Syntax and Semantics

4. Semantic Processing and Attributed Grammars

CMSC 330: Organization of Programming Languages. Context Free Grammars

Advanced Topics in Software Engineering (02265) Ekkart Kindler

Domain-Specific Languages Language Workbenches

Query Processing and Optimization using Compiler Tools

Compilers and interpreters

Syntax Analysis. Chapter 4

CS 3304 Comparative Languages. Lecture 1: Introduction

7. Introduction to Denotational Semantics. Oscar Nierstrasz

An Evaluation of Domain-Specific Language Technologies for Code Generation

Defining syntax using CFGs

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

CMSC 330: Organization of Programming Languages

CSCI 2041: Advanced Language Processing

ECE251 Midterm practice questions, Fall 2010

Syntax Analysis MIF08. Laure Gonnord

COMPILER DESIGN LECTURE NOTES

Transformation of Java Card into Diet Java Card

Syntax-Directed Translation. Lecture 14

COP 3402 Systems Software. Lecture 4: Compilers. Interpreters

CMSC 330: Organization of Programming Languages

In Our Last Exciting Episode

Data Abstraction. An Abstraction for Inductive Data Types. Philip W. L. Fong.

CMPT 379 Compilers. Parse trees

Transcription:

PSOA-to-TPTP Converter Documentation Release 1.0.0 Reuben Peter-Paul, Gen Zou November 07, 2011

CONTENTS 1 Proposal for PSOA-to-TPTP Converter 1 1.1 Introduction............................................... 1 1.2 Objectives................................................ 1 1.3 Methodology............................................... 1 1.4 Tools................................................... 2 2 Files 5 Bibliography 7 i

ii

CHAPTER ONE PROPOSAL FOR PSOA-TO-TPTP CONVERTER 1.1 Introduction Rule Language is a main type of formal languages for knowledge representation in semntic web technologies. PSOA- RuleML [Bol11a] is a rule language which generalizes POSL [Bol04], F-Logic and W3C s RIF-BLD languages [BoKi10a], [BoKi10b]. IN PSOA-RuleML, the positional-slotted, object-applicative (PSOA) term is introduced as a generalization of the frame term and the class membership term in RIF-BLD, as well as the positional-slotted term in POSL language. The planned two-part implementation of PSOA-RuleML is (1) convert PSOA-RuleML s syntax into TPTP format, and (2) reads and executes the TPTP with Vampire theorem prover 1. In this project, we are going to implement part (1) of the overarching project. 1.2 Objectives This project is an important part of PSOA-RuleML implementation. The objectives of the project is as follows: 1. Develop a converter to translate PSOA-RuleML rule language documents into TPTP format documents. The input of the converter is a document conforming to PSOA-RuleML presentation syntax shown in [Bol11a]. The output of the converter is a TPTP-FOF format document. 2. Create some test examples in PSOA-RuleML syntax and their corresponding TPTP format documents for testing the converter. These examples can be further extended to a complete PSOA test suite in the future. 1.3 Methodology 1.3.1 Grammar Specification In order to develop a converter from PSOA-RuleML rule language into TPTP via translation (or transformation). A program specified in PSOA-RuleML must be recognized and parsed into a representation that lends itself to such a transformation. This generally requires the use of a grammar specification via specialized notation: Backus-Naur Form 2, Extended Backus-Naur Form 3 or more less known Parsing Expression Grammar 4. 1 http://www.voronkov.com/vampire.cgi 2 http://en.wikipedia.org/wiki/backus%e2%80%93naur_form 3 http://en.wikipedia.org/wiki/extended_backus%e2%80%93naur_form 4 http://en.wikipedia.org/wiki/parsing_expression_grammar 1

PSOA-to-TPTP Converter Documentation, Release 1.0.0 1.3.2 Compiler-compilers According to [Wp11], a compiler-compiler or compiler generator is a tool that creates a parser (and lexer), an interpreter/compiler from som form of formal description of a language and machine. The most prevalent form of compiler-compiler is a parser-generator whose input is a grammar (like those mentioned above) of a programming language and whose output is a collection of source code for a parser (and lexer) often used as an initial (partial) set of components for a compiler. [Wp11] also mentions an open problem, that is the holy grail of compiler-compilers such that a formal grammar along with a target platforms instruction set may be given as inputs and the result would be a full set of compiler components capable of producing executable bytecode for machines implementing the above instruction set. 1.3.3 Abstract Syntax Trees The result of applying a typical parser generator to a input program (or strings) is a concrete syntax tree, or parse tree: an ordered, rooted tree that represents the syntactic structure of the input according to some formally specified grammar. In a parse tree, the leaves are labeled by terminals of the grammar while the internal nodes are labeled as non-terminals of the grammar. According to [Par07] and [Wp11] typical parser generators associate pieces of executable code (written in a particular target language, e.g. Java, Python, Ruby, etc.). These pieces of code referred to as actions or semantic action routines are executed when a particular rule of the grammar is applied by the parser. These routines may be used to specify the semantics of the syntactic structure that is analyzed by the parser. The result of applying the generated parser with semantic action routines is an abstract syntax tree, or alternatively executable code. In this project we will concern ourselves with abstract syntax trees only, such that the transformation/translation we intend to perform will be done against an AST to produce yet another AST that may be used to yield executable TPTP-FOF strings. 1.4 Tools 1.4.1 RuleML API The primary purpose of the PSOA RuleML API is to provide abstract syntax classes convenient for manipulating language constructs. Any Java sofware using or processing PSOA RuleML will be able to benefit from this functionality. The API will also provide two native parsers into the abstract syntax: a presentation syntax parser to support simple text editor-based authoring, and a parser for the XML serialisation, intended to support rule interchange. [Ria11] 1.4.2 ANTLR and AntlrWorks We will be working with ANTLR, a sophisticated parser-generator tool that is popular and used to implement language interpreters and compilers. ANTLRWorks is a graphical user interface development environment used to facilitate the development of grammars (in EBNF) by providing the researcher with tooling for testing/debugging the generated parser, running the parser against various inputs, running rules in isolation against various inputs, visualizing syntax diagrams of the grammar rules, visualizing the concrete syntax tree produced by applying the generated parser against inputs. 1.4.3 ANTLR Tree Description Language As mentioned above parser generators typically support action routines to be executed on-application of a given rule, ANTLR is no exception. Additionally, it supports a separate mechanism for constructing trees using the -> 2 Chapter 1. Proposal for PSOA-to-TPTP Converter

PSOA-to-TPTP Converter Documentation, Release 1.0.0 operator and ANTLR treed description language. Using ANTLR s tree description language, a tree is written like this: ^( CLASS T ^(VARDEF int i) ^(VARDEF int j) ^(METHOD...)...) This notation may also be used to recognize subtrees, introducing a higher level of abstraction, more suitable for mananging complexities of translating a PSOA-RuleML to another language such as TPTP-FOF. 1.4. Tools 3

PSOA-to-TPTP Converter Documentation, Release 1.0.0 4 Chapter 1. Proposal for PSOA-to-TPTP Converter

CHAPTER TWO FILES Project Document 5

PSOA-to-TPTP Converter Documentation, Release 1.0.0 6 Chapter 2. Files

BIBLIOGRAPHY [Bol11a] Boley H., A RIF-Style Semantics for RuleML-Integrated Positional-Slotted, Object-Applicative Rules, RuleML Europe 2011, 194-211 [Bol04] Boley H., POSL: An Integrated Positional-Slotted Language for Semantic Web Knowledge, http://ruleml.org/submission/ruleml-shortation.html [BoKi10a] Boley H., M. Kifer, A Guide to the Basic Logic Dialect for Rule Interchange on the Web. IEEE Transactions on Knowledge and Data Engineering, 22(11):1593-1608 [BoKi10b] Boley H., M. Kifer, RIF Basic Logic Dialect, http://www.w3.org/tr/rif-bld/ [Wp11] Compiler-Compiler, Wikipedia: The Free Encylopedia, http://en.wikipedia.org/wiki/parser_generator [Par07] Parr T., The Definitive ANTLR Reference: Building Domain Specific Languages, 2007, Pragmatic Programmer, USA. [Ria11] Skype conversation with Alex Riazanov 7