|Online Judge||Problem Set||Authors||Online Contests||User|
Little Quilt is a small language introduced by Ravi Sethi in his book ‘Programming Languages’. Here, a restricted version of Little Quilt is presented.
The language is defined by the following BNF grammar:
A and B represent the two primitive quilts. Each primitive quilt corresponds to a matricial arrangement of 2 × 2 characters. turn() and sew() are operations over quilts.
Accordingly, the instruction
Your job is to build an interpreter of the Little Quilt language.
The input file will be a text file containing different Little Quilt expressions, each one ended by a semicolon character (;). Space and new line characters must be ignored; this means that an expression may span several lines.
The output file contains the quilts produced as a result of interpreting the input expressions.
Each quilt must be preceded by a line, left aligned, with the format
must be printed.
sew(turn(sew(B,turn(B))), turn(sew(turn(B),B))) ; sew(turn(sew(B,turn(B))),A); sew(turn(sew(A,turn(A))), turn(turn( turn(sew(A,turn(A)))))) ;
Quilt 1: ||-- ||-- --|| --|| Quilt 2: error Quilt 3: \\// +\/+ +/\+ //\\
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator