1 / 11

Introducing XAWK: An XML Processing Language Inspired by AWK

XAWK is an XML processing language inspired by AWK, offering pattern matching for XML elements, associative arrays, control statements, and more. This language features implicit promotion, concatenation, and easy XML processing. Learn through examples and implementation details.

bishopfrank
Download Presentation

Introducing XAWK: An XML Processing Language Inspired by AWK

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. XAWK John Cieslewicz Shi Tak Man Gabriela Cretu Prashant Puri

  2. Introduction • XAWK is inspired by the AWK programming language by Aho, et al. • Goal: Provide an easy to use XML processing language whose syntax resembles AWK • Instead of matching text patterns (AWK), match patterns of XML elements (XAWK).

  3. XML Pattern Matching (XPath) Associative Arrays Undeclared variables OK! Fully featured control statements for(x in array) Implicit promotion between strings and numbers Concatenation by juxtaposition Language Features

  4. Example XML File <students> <group name=“XAWK”> <student fname=“John” mt=“45.0”/> <student fname=“Gabriela” mt=“88.9”/> <student fname=“Shi Tak” mt=“66.6”/> <student fname=“Prashant” mt=“67”/> </group> </students>

  5. Example Grading Program /doc(“roster.xml”)/students/group/{ print “Group name: “, @name; /student/{ print “Student name: “, CA[“fname”]; print “Midterm score: “, @mt; } }

  6. Grading with Descendent /doc(“roster.xml”)//group/{ print “Group name: “, @name; /student/{ print “Student name: “, CA[“fname”]; print “Midterm score: “, @mt; } }

  7. More Language Examples j =0; /student/{ name = @fname; studentName[j] = name; grades[name] = @mt; grades[name] += @final; j++; }

  8. XAWK Implementation

  9. XAWK Implementation

  10. XAWK Testing • ant build file for robust compiling and test execution • Shell script for testing ‘failure cases’ • Test cases: • Pattern matching • Control statements • Arrays • Mathematical and Relational Operators • Concatenation • Promotion

  11. Conclusion and Lessons Learned • Antlr can be made to do just about anything, but you might need a crowbar • Testing is very important • Coding in pairs helps catch errors and solve problems • Constant code refactoring keeps it clear and clean • Get to work early, make a good plan

More Related