Ch 3 Exercises

March 27, 2019 | Author: Dane Gardow | Category: Language Mechanics, Logic, Metalogic, Software Engineering, Syntax (Logic)
Share Embed Donate


Short Description

Computer Science...

Description

2. c. Write Write EBNF EBNF descri descriptions ptions for a C switch switch statemen statementt → switch ( ) { case  { ! " { case  { ! " " # defa$%t  { ! " & " '. ewrite ewrite the BNF BNF of Examp%e Examp%e  to to *i+e , precedence precedence o+er - and force force , to e ri*ht associati+e → / Examp%e  → 0 1 B 1 C → , 1 → - 1 → ( ) 1 → / → 0 1 B 1 C → - 1 → , 1 → ( ) 1

. → a  →  1  a. aa → a  → (  ) a ( a)  → aa a   a  a  aa

→ a 1 a 4es

  a 4es.

 . a 4es → a  → (  ) a ( a )  → (  ) a a → (  ) aa → a a  a  a   a  aa

 a a a 4es.

c. aaaaa → a  → ( G" a / 2 - (  )   > G 2 - (  ) >  (  ) > H2 { > 'H2" 2. . Comp$te the weaest precondition for each of the fo%%owin* seI$ences of assi*nment statements and their postconditions a / ' - (2 -  , a)!   / 2 - a  ! { > " 2-a> 2-a>9 a>' ' - (2 -  , a) > ' 2-,a> 2->a {  > (  a) H 2 "

2. c. Comp$te the weaest precondition for each of the fo%%owin* se%ection constr$cts and their postconditions if (x > ) /2-x, e%se

 / ' - x  ! 2-x,>' 2-x>2 x> {x>H'"

'-x>' '-x> x>H'

{ > '"

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF