Chris Murphy Ryan Overbeck Lauren Wilcox Joeng Kim Introduction - - PowerPoint PPT Presentation

chris murphy ryan overbeck lauren wilcox joeng kim
SMART_READER_LITE
LIVE PREVIEW

Chris Murphy Ryan Overbeck Lauren Wilcox Joeng Kim Introduction - - PowerPoint PPT Presentation

Chris Murphy Ryan Overbeck Lauren Wilcox Joeng Kim Introduction AWK What is MOHAWK? A programming language for processing tabular data from text files Largely based on AWK Runtime Architecture


slide-1
SLIDE 1

Chris Murphy Ryan Overbeck Lauren Wilcox Joeng Kim

slide-2
SLIDE 2

Introduction

  • AWK
slide-3
SLIDE 3

What is MOHAWK?

  • A programming language for

processing tabular data from text files

  • Largely based on AWK
slide-4
SLIDE 4

Runtime Architecture

MOHAWK Source Program Input (Text File) Output (Text File) MOHAWK Interpreter

slide-5
SLIDE 5

Mohawk Program

  • A series of pattern/action statements
  • Patterns are:

– “-:-|” (Forward MOHAWK) – “|-:-” (Reverse MOHAWK) – A numeric, boolean, or string valued expression – Nothing.

  • Actions are a series of:

– Math, boolean, and string expressions – Conditional statements – Function calls – I/O Control

slide-6
SLIDE 6

Distinguishing Features

  • Uses ‘!’ as a statement terminator
  • No data types (like AWK)
  • Java style comments
  • Linking numbered fields with

meaningful string identifiers

  • New variable scoping rules
  • Most keywords are IRC style smilies
slide-7
SLIDE 7

Tutorial Introduction/Example

BEGIN BODY END

slide-8
SLIDE 8

Output file I n p u t f i l e

MOHAWK

slide-9
SLIDE 9

Tutorial Introduction / Example

BEGIN BODY END

slide-10
SLIDE 10

Tutorial Introduction / Example

MOHAWK I n p u t f i l e Output file

slide-11
SLIDE 11

MohawkMain MohawkParser MohawkAntlrTokenTypes MohawkFileLoader MohawkWalker MohawkWalkerTokenTypes Front End Tree Walker MohawkStringOperator MohawkMathOperator MohawkLogicalOperator MohawkOperator MohawkFunctionHandler MohawkSymbols MohawkDataType Back End MohawkBreak MohawkContinue MohawkExit MohawkNext Exceptions MohawkLexer

MOHAWK Component Architecture

slide-12
SLIDE 12

Back End Components

add subtract multiply divide mod negate exp MohawkMathOperator equals notEquals lessThan greaterThan lessThanOrEquals greaterThanOrEquals match

  • r

and not MohawkLogicalOperator concatenate MohawkStringOperator intValue floatValue booleanValue MohawkDataType push pop branch endBranch put putGlobal get link exists cleanFieldVariables MohawkSymbols register call MohawkFunctionHandler

slide-13
SLIDE 13

Testing

  • Unit Testing

– JUnit – Test operators

  • Parser Testing

– Expected Tokens

  • Function Testing

– Expected Output

slide-14
SLIDE 14

Lessons Learned

  • Good language design requires balance
  • Impossible to stick to original specifications
  • Details behind creating a language

– Operator Precedence – Variable Scoping – Data type Manipulation

  • Importance of Testing Early and Testing Often