DB Directive
The DB assembler directive is used for
allocation of initialized bytes. To help describe repeating byte
sequences repetition operator DUP can be used, moreover it can be used
recursively. After processing the DB directive translator allocates
corresponding number of bytes and fills them with values specified in the DB directive as parameters.
It is required to write a handler for the DB
directive.
For reference
Directive DB has the following syntax for our problem:
dir_DB ::= "DB " list
list ::= string | expression { "," string | expression }
string ::= "'" { character } "'"
expression ::= count "DUP" "(" list ")"
All characters are latin letters and digits. "count" is a positive integer
less than 1000. Curly braces mean iteration - they are substituted by their
contents repeated 0 or more times. All terms can be separated by 0 or more
spaces.
Input
Input consists of the DB directive.
Output
Output has to contain string of characters translator has
written in place of allocated bytes. It is guaranteed the output string will be
not more than 250 characters long.
Sample Input
DB 3 DUP( 'def' , 2 DUP ('ab'),'1') , 'ttt'
Sample Output
defabab1defabab1defabab1ttt