Grammar X 1 100

broken image


The consonants with vowel sounds include f, h, l, m, n, r, s, and x. He flew in an SST. He fired an M‑1. He attended an FDA hearing. By the same token, if a vowel letter, with a consonant sound, is pronounced as a letter, you should use a. He made a U‑turn. So what is your grade? Surely not an F. 2 1 English Grammar 101 1.1.1 Noun=Subject(Person,Place,Thing). Thecatsatonthemat. George Washington wasAmerica'sfirstPresident. 1.1.2 Pronoun=ExpressesaDistinctionofaPerson Pronounassubject Pronounasobject Possessivepronoun Reflexivepronoun IMe Mine Myself You You Yours Yourself He Him His Himself She Her Hers Herself It It Its Itself. Watch a free excerpt from Lesson 1 of the Basic Cozy Grammar Course where Marie uses clear and concrete examples from life in her cozy beach cottage to illustrate the four kinds of sentences: assertive, interrogative, imperative, and exclamatory. Mar 09, 2009 Depends in what context you're using it. To the layman $100 would be acceptable. However this does not differentiate between the New Zealand Dollar, Australian Dollar, US Dollar etc. So, the 3 letter currency symbols for all currencies is a better way to express it. So 100.00 USD would be the correct way.

  1. X-1 Champions
  2. Grammar X 1 100 Percent

CS4613 Assignment 3

Sample Solution

  1. (15%) Write EBNF descriptions for the following

a)A Java class definition header statement

The following is an example class header statement:

public class A extends B implements C, D

where 'public' is a modifier and 'A' ,'B', 'C', and 'D' are identifiers. Assume non-terminal is given.

<method_head> -> [public] [(abstract | final)] class [extends ] [implements {, }]

b)A C/C++/Java switch statement

The following is an example switch statement:

switch (a+b)

{

case 1 : x = 7; break;

case 2 :x = 8; break;

default : x = 9;

}

where 'a+b' is an expression, '1' and '2' are literals, and 'x=7;break;', 'x=8;break;' and 'x=9;' are statement lists. Assume non-terminals <expr>, , and <stmt_list> are given.

<switch> -> switch ‘(‘ <expr> ‘)' ‘{‘ {case : <stmt_list>} [default : <stmt_list>] ‘}'

c)A C/C++/Java for-loop statement

The following is an example for statement:

for (int k = 0, m = 100;k < n;k++, m++)

{

x = x + 1;

y = y – 1;

}

where 'int k = 0, m = 100' is an variable declaration, in which 'int' is a type name, 'k' and 'm' are identifiers, and '0' and '100' are literals. Ifthere is no appearance of 'int', 'k = 0, m = 100' are a sequence of assignments. Also, 'k < n' is an expression, 'k++; m++' are also expressions, and 'x=x+1;y=y+1;' is a statement list.

Assume the following non-terminals are given: , , , , <expr>, and <stmt_list>.

<for> -> for ‘(‘ [[] = <expr> {, [] = <expr>}] ; [<expr>] ; [<expr> {, <expr>}] ‘)' ‘{‘ <stmt_list> ‘}'

  1. (15%) Prove that the following grammar is ambiguous:

->

-> + |

<id> -> a | b | c

Example ambiguous sentence: a + b + c

Parse tree 1:

<id>

a

+

<id>

b

+

<id>

c

Parse tree 2:

<id>

a

+

Figment 1 1 8 – a musical action adventure game.

<id>

b

+

<id>

c

Note in the above representation of a tree, all symbol(s) withN column indentations are children nodes of the parent node that is immediately above these symbol(s) and has N-1 column indentations.

  1. (10%) Convert the following recursive BNF grammar to EBNF without recursion:

<assign> -> = <expr>

<expr> -> + <expr>

| * <expr>

|( <expr> )

|

<assign> -> = <expr>

<expr> -> {(+ | *) }

<term> -> ‘(‘ <expr> ‘)'

  1. (10%) Convert the following EBNF grammar to BNF:

S -> A { b A}

A -> a [ b ] A

S -> A | A B

B -> b A | b A B Diskcatalogmaker 6 5 11 download free.

Grammar X 1 100

A -> a A | a b A

  1. (30%) Given the following BNF as the basis:

<assign> -> = <expr>

<id> -> a

<id> ->b

<id> ->c

<expr> -> + <expr>

<expr> -> * <expr>

<expr> -> ( <expr> )

<expr> ->

and give the following attribute grammar:

a.Syntax rule: -> <var> = <expr>

Sementic rule: <expr>.expected_type <- <var>.actual_type

b.Syntax rule: <expr> -> <var>[2] + <var>[3]

Semantic rule: <expr>.actual_type <- if (<var>[2].actual_type = int) and (<var>[3].actual_type = int) then int else real end if

Predicate: <expr>.actual_type = <expr>.expected_type

c.Syntax rule: <expr> -> <var>

Semantic rule: <expr>.actual_type <- <var>.actual_type

Predicate: <expr>.actual_type = <expr>.expected_type

d.Syntax rule: <var> -> A | B | C

Semantic rule: <var>.actual_type <- look-up(<var>.string)

Write an attribute grammar for the given BNF with the same semantic rules as the given attribute grammar

a) <assign> -> = <expr>

semantic rule: <expr>.expected_type <- <var>.actual_type

b) <expr>[1] -> + <expr>[2]

Semantic rule: <expr>[1].actual_type <- if (.actual_type = int) and (<expr>[2].actual_type = int) then int else real end if

Predicate: <expr>[1].actual_type = <expr>[1].expected_type

c) <expr> -> * <expr>

Semantic rule: <expr>[1].actual_type <- if (.actual_type = int) and (<expr>[2].actual_type = int) then int else real end if

Predicate: <expr>[1].actual_type = <expr>[1].expected_type

d) <expr>[1] -> ( <expr>[2] )

Semantic rule: <expr>[1].actual_type <- <expr>[2].actual_type

Predicate: <expr>[1].actual_type = <expr>[1].expected_type

e) <expr> ->

Semantic rule: <expr>.actual_type <- .actual_type

Predicate: <expr>.actual_type = <expr>.expected_type

f) <id> -> a | b | c

Semantic rule: .actual_type <- look-up(.string)

  1. (20%) Modify the attribute grammar given in Question 5 with the following new semantic rules:

Data types cannot be mixed in expressions, but assignment statements need not have the same type on both sides of the assignment operator.

a.Syntax rule: -> <var> = <expr>

X-1 Champions

Sementic rule: <expr>.expected_type <- <var>.actual_type

b.Syntax rule: <expr> -> <var>[2] + <var>[3]

Symantec endpoint protection 14 for mac free download. Semantic rule: <expr>.actual_type <- <var>[2].actual_type

Predicate: <var>[2].actual_type = <var>.[3].actual_type

c.Syntax rule: <expr> -> <var>

Semantic rule: <expr>.actual_type <- <var>.actual_type

d.Syntax rule: <var> -> A | B | C

Semantic rule: <var>.actual_type <- look-up(<var>.string)

Use our → number generator to see how to spell any desired number.

Table of Cardinal Numbers

Cardinal numbers from 1 through 1,000,000
1one11eleven21twenty-one31thirty-one
2two12twelve22twenty-two40forty
3three13thirteen23twenty-three50fifty
4four14fourteen24twenty-four60sixty
5five15fifteen25twenty-five70seventy
6six16sixteen26twenty-six80eighty
7seven17seventeen27twenty-seven90ninety
8eight18eighteen28twenty-eight100a/one hundred
9nine19nineteen29twenty-nine1,000a/one thousand
10ten20twenty30thirty1,000,000a/one million

Separation between hundreds and tens

Hundreds and tens are usually separated by 'and' (in American English 'and' is not necessary).

110 - one hundred and ten
1,250 - one thousand, two hundred and fifty
2,001 - two thousand and one

Hundreds

Use 100 always with 'a' or 'one'.

100 - a hundred / one hundred

'a' can only stand at the beginning of a number.

100 - a hundred / one hundred
2,100 - two thousand, one hundred

Thousands and Millions

Use 1,000 and 1,000,000 always with 'a' or 'one'.

Grammar X 1 100 Percent

1,000 - a thousand / one thousand
201,000 - two hundred and one thousand

Use commas as a separator.

57,458,302

The Number 1,000,000,000

In English this number is a billion. This is very tricky for nations where 'a billion' has 12 zeros. 1,000,000,000,000 in English, however, is a trillion.

But don't worry, these numbers are even a bit problematic for native speakers: for a long time the British 'billion' had 12 zeros (a number with 9 zeros was called 'a thousand million'). Now, however, also in British English 'a billion' has 9 zeros. But from time to time this number still causes confusion (just like this paragraph, I'm afraid). ;o)

Singular or Plural?

Numbers are usually written in singular.

two hundred Euros
several thousand light years

The plural is only used with dozen, hundred, thousand, million, billion, if they are not modified by another number or expression (e.g. a few / several).

hundreds of Euros
thousands of light years

Exercise





broken image