Programming standards

 

 

 

Can you program this homework assignment with the following requirements?

[yono002@empress ~]$ g++ –version

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)

/* this is the version of c++ so it must be compatible*/

Also, follow the programming standards page.

Write an interpreter C++ for a very simple pseudo-code. The instructions on a one-accumulator virtual machine are as follows:

Format Meaning

1XXX Load accumulator with contents of XXX

2XXX Store accumulator into location XXX

3XXX Add contents of XXX to accumulator

4XXX Subtract contents of XXX from accumulator

5XXX Multiply contents of XXX to accumulator

6XXX Divide contents of XXX by accumulator

7XXX Branch to instruction XXX if accumulator is positive

8XXX Branch to instruction XXX if accumulator is negative

9XXX Stop (except 9999)

The format of a pseudo-code program is as follows:

Initial Data Values

9999

Pseudo code program consists of the above instructions

9999

The memory unit of our virtual machine is 2000 words and each word holds an integer less than or equal to +9999. The first half of the memory is used for storing data and the second half is for storing program instructions. The initial data values should be read into the beginning of the data area of the memory unit in that order. The validity of the values in the memory should always be checked. The pseudo code instructions should be read into the program instruction area of the memory unit before the program execution cycles start.

You will have to implement your program, say, interpreter.c, on our Unix system on empress.csusm.edu. You are supposed to prepare a pseudo code test program as the input to your pseudo-code interpreter. The output of your interpreter has to demonstrate that at least one instruction of each format in your test program is executed for at least once and both possibilities of the branch instruction are tested. A shell command script file compiling and running your program should also be prepared. The files of source program, input, output, and shell script must be submitted as one zipped file.

The documentation, implementation and testing of your program should be done according to the Standards of Programming Assignments.

A sample input file (PseudoCodeTestProgram) to your program is as follows:

1

2

3

4

5

9999

1000

2001

3004

4001

5002

6004

7004

8003

9000

9999

The content of a sample shell script file, say, interpreter.sh, consisting Unix commands is as follows:

gcc –o interpreter.out interpreter.c

interpreter.out < PseudoCodeTestProgram > OutputDisplay

Its sample output file (OutputDisplay) could have the following content:

ACC = 0 PC = 0 Next Instruction = 1000

Initialized Memory = 0:1, 1:2, 2:3, 3:4, 4:5

ACC = 1 PC = 1 Next Instruction = 2001

Initialized Memory = 0:1, 1:2, 2:3, 3:4, 4:5

ACC = 1 PC = 2 Next Instruction = 3004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 6 PC = 3 Next Instruction = 4001

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 5 PC = 4 Next Instruction = 5002

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 15 PC = 5 Next Instruction = 6004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 3 PC = 6 Next Instruction = 7004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 3 PC = 4 Next Instruction = 5002

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 9 PC = 5 Next Instruction = 6004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 1 PC = 6 Next Instruction = 7004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 1 PC = 4 Next Instruction = 5002

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 3 PC = 5 Next Instruction = 6004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 0 PC = 6 Next Instruction = 7004

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 0 PC = 7 Next Instruction = 8003

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

ACC = 0 PC = 8 Next Instruction = 9000

Initialized Memory = 0:1, 1:1, 2:3, 3:4, 4:5

 

 

 

 

 

Sample Solution

e Unie is seen by their involvement in German schemes of labour service and “WInterhulp’ (food aid) despite the schemes exploiting the Dutch (Smith, 1987, p.266). The Unie then however began to serve as a platform for opposition and a symbol of national solidarity (Mazower, 2008, p.477). Seyss-Inquart’s strategy of Nazification turned out to be a serious miscalculation, as despite relative cooperation from the Unie, they refused to make the ideological adjustment required to become Nazis (Hirschfeld, 1988, p.35). The support for the strike of February 1941, in retaliation to the cruelty towards 400 Jews (De Jong, 1990, p.35), added to the reasons why the German occupation formally banned the Unie in December 1941 (Smith, 1987, p.267). By the end of 1941, therefore it could be argued that Seyss-Inquart had realised that the vast majority of the population would not embrace self-Nazification.

Further failure with the German policy of Nazification can be seen with the subsequent use of the NSB. After the ban of the Nederlandse Unie, Anton Mussert’s NSB was declared the only party still legal under German occupation (Hirschfeld, 1981, p. 481). The NSB, the Dutch equivalent of the Nazi party, had grown in prominence since the invasion and despite having a marginal pre-war presence swelled to include as many as 75,000 wartime members (Foray, 2010, p.775). As the only remaining party, this meant that it was generally either German officials or NSB members in high positions of office throughout the Netherlands (Warmbrunn, 1963, p.37). The German occupation had hoped not to utilise the party to such an extent as it was severely disliked by the majority of the Dutch public, being regarded as politically and morally corrupt (Hirschfeld, 1988, p.39). The Dutch public would not support any policy from such a disliked party, especially when some of the attempts to establish Nazi organisations came from the NSB rather than the German authorities (Warmbrunn, 1963, p.263). Furthermore, the growth of anti-German sentiment after 1941 is representative of the failure of the German Nazification policy. The anti-Nazi attitude manifested itself in 3 main strikes: the aforementioned February 1941 Amsterdam strike against the treatment of Jews; the Spring 1943 strike in retaliation to the reinternment of the Dutch armed forces; and 17th September 1944 strike ordered by the exiled government on Dutch railwaymen as the Allies attempted to invade (De Jong, 1990, p.34). In terms of the 1943 strike, Christiansen, the supreme commander of the German Wehmacht, ordered the members of the Dutch army that had previously been released in 1940 to report for reinternment. There was a large amount of resistance to this policy with few soldiers responding to the order and a general strike from workers and business owners taking place throughout the country, united against Nazification (Ibid., pp.34-35). This strike in particular showed that even after 3 years of German occupation, the Dutch peop

This question has been answered.

Get Answer