1 / 16

Update Meeting August 7 th , 2013

Update Meeting August 7 th , 2013. Agenda. Overview of technical progress Grammar-based implementation. Overview of Technical Progress. Reviewed methods of parsing grammars in C++ Open source frameworks Stream parsing Etc. Grammar Parser. Preferred Flex and Bison

elie
Download Presentation

Update Meeting August 7 th , 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Update MeetingAugust 7th, 2013

  2. Agenda • Overview of technical progress • Grammar-based implementation

  3. Overview of Technical Progress • Reviewed methods of parsing grammars in C++ • Open source frameworks • Stream parsing • Etc.

  4. Grammar Parser • 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

  5. Framework • 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

  6. Framework • Looked back to EpochX for inspiration in designing a set of primitives for a grammar • Rolled back to version 1.33.3 • Custom grammar rules implemented completely differently • Most of all, it “works” • Nodal evaluation easily triggered

  7. Framework • 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

  8. Grammar Output • Sample output • CODE_INJECTION( CHAR0() 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);

  9. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= ";

  10. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= "; High level roles

  11. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= "; Strategy definitions

  12. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= "; C types (with and without subtree)

  13. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= "; Start of C BNF grammar

  14. Grammar-Based Implementation public static final String GRAMMAR_FRAGMENT = "<program> ::= <node>\n" + "<node> ::= <strategy> | <role> | <terminal>\n“ + "<role> ::= BUFFER ( <node> )\n + "<strategy> ::= WRAPPER( <type> , <node> , <terminal> ) " + "| FUNCTION_POINTER( <type> , <node> , <terminal> )" + "| CODE_INJECTION( <code> )\n" + "<type> ::= INT( <terminal> ) | DOUBLE( <terminal> ) " + "| FLOAT( <terminal> ) | CHAR( <terminal> )\n" + "<type0> ::= INT0() | DOUBLE0() | FLOAT0() | CHAR0()\n" + "<code> ::= <method>\n" + "<method> ::= <type0> <terminal> LPARAN RPARAN\n" + "<terminal> ::= "; Terminal nodes (target method, parameters, etc.)

  15. Grammar-Based Implementation • 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.)

  16. Next Steps • 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…

More Related