 Overview of technical progress  Grammar-based implementation.

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
CPSC Compiler Tutorial 9 Review of Compiler.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
ISBN Chapter 3 More Syntax –BNF –Derivations –Practice.
Honors Compilers The Course Project Feb 28th 2002.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
1 Type Type system for a programming language = –set of types AND – rules that specify how a typed program is allowed to behave Why? –to generate better.
CS784 (Prasad)L167AG1 Attribute Grammars Attribute Grammar is a Framework for specifying semantics and enables Modular specification.
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta,
CSc 453 Semantic Analysis Saumya Debray The University of Arizona Tucson.
Syntax Directed Definitions Synthesized Attributes
1 Abstract Syntax Tree--motivation The parse tree –contains too much detail e.g. unnecessary terminals such as parentheses –depends heavily on the structure.
CPSC 388 – Compiler Design and Construction Parsers – Context Free Grammars.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Compiler1 Chapter V: Compiler Overview: r To study the design and operation of compiler for high-level programming languages. r Contents m Basic compiler.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
LANGUAGE TRANSLATORS: WEEK 3 LECTURE: Grammar Theory Introduction to Parsing Parser - Generators TUTORIAL: Questions on grammar theory WEEKLY WORK: Read.
1 Semantic Analysis Aaron Bloomfield CS 415 Fall 2005.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
1 Top Down Parsing. CS 412/413 Spring 2008Introduction to Compilers2 Outline Top-down parsing SLL(1) grammars Transforming a grammar into SLL(1) form.
Outline Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs Graphics Applets Drawing Shapes.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
410/510 1 of 18 Week 5 – Lecture 1 Semantic Analysis Compiler Construction.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
BUILD ON THE POLYGLOT COMPILER FRAMEWORK MIHAL BRUMBULLI 7th Workshop “SEERE” Montenegro-Risan 9-14 September 2007 SimJ Programming Language.
1 Grammar Refactoring December 13 th, 2013 Erik Fredericks.
Java Basics.  To checkout, use: svn co scb07f12/UTORid  Before starting coding always use: svn update.
Mitchell McMullen Paul Nguyen SWAN. Python written entirely in C#. Can access all.NET libraries and Silverlight. Created by the same guy as Jython. No.
CPS 506 Comparative Programming Languages Syntax Specification.
Strongly Formed Genetic Programming 06/19/2013. Agenda Strongly formed genetic programming (SFGP) Where it fits Current progress Next steps.
Types in programming languages1 What are types, and why do we need them?
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
D Goforth COSC Translating High Level Languages Note error in assignment 1: #4 - refer to Example grammar 3.4, p. 126.
Chapter 3 Describing Syntax and Semantics
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Parser Generation Using SLK and Flex++ Copyright © 2015 Curt Hill.
PZ03BX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03BX - Recursive descent parsing Programming Language.
PZ03BX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03BX –Recursive descent parsing Programming Language.
1 February 23, February 23, 2016February 23, 2016February 23, 2016 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University.
BY: JAKE TENBERG & CHELSEA SHIPP PROJECT REVIEW: JGIBBERISH.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Mid-Terms Exam Scope and Introduction. Format Grades: 100 points -> 20% in the final grade Multiple Choice Questions –8 questions, 7 points each Short.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Intro to Programming STARS College of Communication and Information Florida State University Written by: Hannah Brock Alissa Ovalle Nicolaus Lopez Martin.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Chapter 3 – Describing Syntax
Parsing and Parser Parsing methods: top-down & bottom-up
Chapter 3 – Describing Syntax
CS 153: Concepts of Compiler Design October 17 Class Meeting
Overview of Compilation The Compiler BACK End
5 Variables, Data Types.
Unit-2 Objects and Classes
Overview of Compilation The Compiler BACK End
Programming Languages 2nd edition Tucker and Noonan
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Programs and Classes A program is made up from classes
Java Programming Review 1
The Recursive Descent Algorithm
Subtype Substitution Principle
Presentation transcript:

 Overview of technical progress  Grammar-based implementation

 Reviewed methods of parsing grammars in C++  Open source frameworks  Stream parsing  Etc.

 Preferred Flex and Bison  Flex for interpreting the incoming grammar  Bison for generating tokens  Both are open-source and have available Windows ports  Both are standalone executables that can be built into Visual Studio’s custom build rules

 Began primitive implementation within OpenBEAGLE  Continually had issues with run-time errors in customizing examples ▪ Simple conversion of Even Parity example from Boolean to String

 Looked back to EpochX for inspiration in designing a set of primitives for a grammar  Rolled back to version  Custom grammar rules implemented completely differently ▪ Most of all, it “works” ▪ Nodal evaluation easily triggered

 To continue to make progress, I moved ahead with the EpochX implementation  Customized C BNF grammar  Composition strategies  High-level role assignments to sub-trees

 Sample output  CODE_INJECTION( CHAR 0 () bubbleSort LPARAN RPARAN) ▪ Inject the following code: ▪ char bubbleSort();  BUFFER( FUNCTION_POINTER( CHAR(bubbleSort), numbers, int*)) ▪ Create a function pointer under the ‘Buffer’ role: ▪ char (*sort)(int*) = bubbleSort; ▪ Buffer = sort(numbers);

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= ";

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= "; High level roles

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= "; Strategy definitions

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= "; C types (with and without subtree)

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= "; Start of C BNF grammar

public static final String GRAMMAR_FRAGMENT = " ::= \n" + " ::= | | \n“ + " ::= BUFFER ( )\n + " ::= WRAPPER(,, ) " + "| FUNCTION_POINTER(,, )" + "| CODE_INJECTION( )\n" + " ::= INT( ) | DOUBLE( ) " + "| FLOAT( ) | CHAR( )\n" + " ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + " ::= \n" + " ::= LPARAN RPARAN\n" + " ::= "; Terminal nodes (target method, parameters, etc.)

 Implementation  Java classes provided for each non-terminal node that requires evaluation ▪ Strategies ▪ Types ▪ Etc.  Tree shape determined by grammar constraints  Fitness to be determined by SW-engineering metrics ▪ (e.g. Lines of code, complexity, number of transformations, etc.)

 Continue grammar implementation  C BNF, identify ‘canned transformations’ ▪ Int.toString() could be represented by a known set of C statements  Define fitness function  Impact of code  Fan-in / fan-out  Others…