Pattern questions.


R. Clayton (rclayton@clayton.cs.monmouth.edu)
Wed, 17 Jan 2001 19:01:09 -0500 (EST)


  Is the match text $1 = $2 $3 $4 syntactically correct?

Yes; each pattern variable can be assigned one of the four types they can
match (instruction, memory, operator, constant) and together they form a
syntatically valid instruction.

   Will this match text match the code: m[3] = m[2] + m[1]?

Yes, with $1 = m[3], $2 = m[2], $3 = +, and $4 = m[1].

   More generally speaking, can you have sequence of pattern variables with no
   characters in between?

Yes, as long as you can assign each pattern variable one of the four types
(instruction, memory, constant, operator) it may represent.

  Another example, does $1 = $2 $3 m[1] match m[3] = m[2] + m[1]?

Yes, with $1 = m[3], $2 = m[2], and $3 = +.



This archive was generated by hypermail 2.0b3 on Thu May 17 2001 - 12:00:05 EDT