XAWK - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

XAWK

Description:

XAWK is inspired by the AWK programming language by Aho, et al. ... Instead of matching text patterns (AWK), match patterns of XML elements (XAWK) ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 12
Provided by: johnc176
Category:
Tags: xawk | awk

less

Transcript and Presenter's Notes

Title: XAWK


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
Language Features
  • 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

4
Example XML File
  • ltstudentsgt
  • ltgroup nameXAWKgt
  • ltstudent fnameJohn mt45.0/gt
  • ltstudent fnameGabriela mt88.9/gt
  • ltstudent fnameShi Tak mt66.6/gt
  • ltstudent fnamePrashant mt67/gt
  • lt/groupgt
  • lt/studentsgt

5
Example Grading Program
  • /doc(roster.xml)/students/group/
  • print Group name , _at_name
  • /student/
  • print Student name , CAfname
  • print Midterm score , _at_mt

6
Grading with Descendent
  • /doc(roster.xml)//group/
  • print Group name , _at_name
  • /student/
  • print Student name , CAfname
  • print Midterm score , _at_mt

7
More Language Examples
  • j 0
  • /student/
  • name _at_fname
  • studentNamej name
  • gradesname _at_mt
  • gradesname _at_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
Write a Comment
User Comments (0)
About PowerShow.com