Register machine syntax checker and translator (Version )

Size: px
Start display at page:

Download "Register machine syntax checker and translator (Version )"

Transcription

1 Register machine syntax checker and translator (Version ) Aniruddh Gandhi University of Auckland April 20, 2012

2 Table of Contents 1 Overview Strict and relaxed versions Chi-Kou programming language Examples Elena programming language Binary encoding of progams Simple encoding Prefix-free encoding Syntax checker and translator Installation Examples of usage Example of a complete relaxed Chi-Kou program and its strict form Appendix A: Adding/removing tests to tests.xml Appendix B: Another strict version of the Elena programming language Appendix C: Building the project from the source code

3 1 Overview This document describes the programming languages described in [1] and [2] and the conversion of human-readable programs into a binary form. The programming languages of [1] and [2] have very similar instruction sets. However the language of [2] offers more flexibility in some instructions as we will describe later. For the sake of convenience, we refer to the programming language of [1] as the Chi-Kou programming language and the one described in [2] as the Elena programming language. The underlying machine model for both these languages is a register machine equipped with a finite number of registers which may store arbitrarily large non-negative binary integers. 2 Strict and relaxed versions Both Elena and Chi-Kou have two versions : strict and relaxed. The strict version contains a small set of instructions which can be directly converted into binary code. The relaxed version adds some features to the strict version (such as line labels, subroutines etc.) to make it easier to program in these languages. The relaxed version of a Elena or Chi-Kou program may be converted to the strict version which may in turn be converted into binary code. The next table shows a side by side comparison of strict and relaxed code (for both Elena and Chi-Kou). For a detailed description of the two languages and their strict and relaxed versions, the reader is directed to sections 3 and 4. 3

4 Chi- Kou (relaxed) &a, Sub =bc, 10, a Sub: +c, 21 L1:!c &ab, LX1 //Comment =c,1,ab LX1: +d,34 % Elena (relaxed) &a, Sub1t1 =bc23, 10, az Sub1t1: +c, 21 L1w:!c &ab, LX1t3 //Comment =c,1,ab2x LX1t3: +d,34 % Chi- Kou (strict) &a, 10 +bc, 1010, a +c, 10101!c &ab, 110 =c,1,ab +d, % Elena (strict) 0 & a 2 1 = bc23 10 az 2 + c 21 3! c 4 & ab 6 5 = c 1 ab2x 6 +d 34 7 %

5 3 Chi-Kou programming language The registers are identified with a string of characters from a to h and have the initial value 0. Strictly speaking, to be syntactically correct the first occurrence of a register j must be after the occurrence of a register i < j (< is the lexicographic order on strings) and furthermore, all the registers lexicographically less than j must have occurred. However this requirement may be relaxed if desired. Instructions are labeled by 0, 1,... in binary. The instructions of the strict version of Chi-Kou are described below. It is important to note that in the following list, R2 always denotes either a variable or a non-negative integer constant in binary form(which is of the form 1 (0 + 1) + 0). The symbols R1, R3 are always register variables. 1. =R1, R2, R3. This instruction compares the contents of the register R1 with contents of R2 (register or binary constant) and if identical, the program jumps to the R3-th instruction. If R3 = 0, the control is transferred to the first line of the program. If the contents of R1, R2 are not identical, then the execution continues with the next instruction. Note that an illegal branch error results if the contents of R3 are outside the scope of the program. 2. &R1, R2. This instruction replaces the contents of the register R1 by the contents of R2 (register or binary constant). 3. +R1, R2. The contents of register R1 are replaced by the sum of the contents of R1 and R2 (register or binary constant). 4.!R1. One bit is read in (from the input) and the contents of the register R1 are replaced by this bit i.e. the numerical value of R1 becomes 0 or 1 after this instruction. An attempt to read past the last data bit is a run-time error. 5. %. This is the last instruction of each Chi-Kou program and represents the end of the program. Raw data follows this instruction, It halts the execution in two possible states: either successfully or with an under-read error. We refer to this instruction as the HALT instruction for convenience. A strict Chi-Kou program consists of a finite sequence of labelled instructions such that the HALT instruction appears exactly once. The raw data in the form of a binary string follows the HALT instruction. A program not reading the whole data or attempting to read past the last bit of the data results in a run-time error. We now describe the relaxed version of the Chi-Kou programming language: 1. All non-negative integer constants are interpreted to be in decimal format (and not binary). 2. The letter L followed by zero or more letters followed by one or more digits (e.g. L1, Lx21, LA1 etc.) and then a colon (eg. L1:) is used to mark line numbers and such references are local within a subroutine. In the strict form, these references are replaced by the line number corresponding to the label. 5

6 3. The first instruction of every subroutine must be marked by a unique label is a string made up of alphabetic letters only followed by a :. This is understood to be the name of the subroutine. 4. For subroutines, registers r0, r1,... are used for temporary values and probably need to be initialized (for correctness). These are local to the subroutine. We use C++ style comments (for example //comment ) to indicate comments in the code. 3.1 Examples Now we give examples of some simple relaxed Chi-Kou subroutines. Note that these are intended to appear in a larger program and therefore the convention relating to the lexicographic ordering of register names may not be followed in the examples. The following simple Chi-Kou program is a subroutine (Cmp(a, b)) which takes two positive integer arguments (a, b) and returns 1 if a < b, 0 if a = b or 2 if a > b. // Cmp(a,b) returns 0,1,2 Cmp: &d,0 // 0 if a=b =a,b,c +d,1 // 1 if a<b &r 0,a &r 1,b &r 2,L1 &r 3,L2 L1: +r 0,1 +r 1,1 =r 0,b,c =r 1,a,r 3 =a,a,r 2 L2: +d,1 // 2 if a>b Next we describe the subroutine Mul(a, b) which returns a b. // Mul(a,b) returns a*b Mul: &d,0 &r 0,L1 &r 1,0 L1: =r 1,b,c +r 1,1 +d,a // add a=0 is okay =a,a,r 0 6

7 An example of a subroutine that calls other subroutines is Div(a, b) which returns a/b and assumes that b > 0. // Div(a,b) returns integer floor of a/b, assumes b>0 Div: &r 0,L1 &r 1,L2 &r 2,a // copy of a (variable not used in Cmp & Mul) &r 3,b // copy of b &r 4,c // copy of c &r 5,1 // initial answer &c,l0 &d,cmp =a,a,d // call Cmp(a,b) L0: &c,r 2 =d,0,r 0 =d,2,r 1 &d,0 // else a < b so return 0 L1: &d,1 // a=b so return 1 L2: &c,l5 &r 6,Mul &a,r 5 =a,a,r 6 L5: &a,d // just computed ad*b &b,r 2 &c,l6 &r 6,Cmp =a,a,r 6 // call Cmp(ad*b,a) L6: &b,r 3 // reset b &r 6,L3 =d,1,r 6 &r 6,L4 =a,a,r 6 L3: +r 5,1 // still < =a,a,r 1 L4: &d,r 5 &a,r 2 // unpop input parameters &b,r 3 &c,r 4 4 Elena programming language The instructions of the strict version of the Elena programming language are described below. The important difference from Chi-Kou is that R2, R3 may 7

8 represent either registers or non-negative integer constants while R1 is always a register. Furthermore the registers may be named by arbitrary strings of alphanumeric characters (starting with an alphabet). In the following, l denotes an integer representing the instruction number. All constants are interpreted as decimal constants. 1. l = R1 R2 R3. This instruction compares the contents of the register R1 with contents of R2 and if identical, the program jumps to the R3-th instruction. If R3 = 0, the control is transferred to the first line of the program. If the contents of R1, R2 are not identical, then the execution continues with the next instruction. Note that an illegal branch error results if the contents of R3 are outside the scope of the program. 2. l & R1 R2. This instruction replaces the contents of the register R1 by the contents of R2 (register or decimal constant). 3. l + R1 R2. The contents of register R1 are replaced by the sum of the contents of R1 and R2 (register or decimal constant). 4. l! R1. One bit is read in (from the input) and the contents of the register R1 are replaced by this bit i.e. the numerical value of R1 becomes 0 or 1 after this instruction. An attempt to read past the last data bit is a run-time error. 5. l %. This is the last instruction of each Elena program and represents the end of the program. Raw data follows this instruction, It halts the execution in two possible states: either successfully or with an under-read error. We refer to this instruction as the HALT instruction for convenience. We now describe the relaxed version of the Elena programming language: 1. All non-negative integer constants are interpreted to be in decimal format. 2. The letter L followed by any alphanumeric character and then a colon (eg. L1:) is used to mark line numbers and such references are local within a subroutine. In the strict form, these references are replaced by the line number corresponding to the label. 3. For subroutines, registers r0, r1,... are used for temporary values and probably need to be initialized (for correctness). These are local to the subroutine. 4. The first instruction of every subroutine must be marked by a unique label is a string made up of alphanumeric letters followed by a :. This label must start with an alphabet excluding L and r. This is understood to be the name of the subroutine. We use C++ style comments (for example //comment ) to indicate comments in the code. 5 Binary encoding of progams The binary encoding maps the characters, &, =, +,!, % to unique binary strings. Also every register is mapped onto a unique binary string. The encoding also 8

9 assigns a unique binary string to every non-negative integer. Given an integer x, we use code(x) to denote the binary string corresponding to it. Given a relaxed program written in Chi-Kou or Elena, the conversion of this program into a binary machine-executable version is a two stage process: 1. The first stage is to convert the relaxed program into a strict program. Here we perform the following actions: (a) We strip the comments from the code and then check whether the syntax of the program is correct. (b) We then replace all labels that occur in the instructions (e.g. L1, Cmp etc.) by the line numbers corresponding to the labels and remove the labels. Hence &a, L1 would be replaced by &a, code(x) where x is the nonnegative integer line number where L1 occurs. (c) In every subroutine, we replace the temporary register r i with the unique register name of the form Sub i where Sub is the name of the subroutine. In the future, we may add an optimization where each r i is replaced by non-conflicting global registers e, f,... to reduce the number of registers used. (d) All non-negative constants appearing in the instructions are replaced by their binary equivalents in the case of Chi-Kou(as given by the encoding). Hence &a, x would be replaced by &a, code(x) where x is a nonnegative integer. In the case of Elena, we do not change the constants from decimal to binary. (e) We rename the registers in two possible ways (this is specified by the user as an option). The first way is to rename the registers in lexicographic order by order of appearance in the program. The second way is to rename the registers based on the frequency of occurrences and the relative sizes of their binary encodings. So for example, suppose register a occurs 21 times and register aa occurs 31 times. If the binary encoding of a is 010 and the binary encoding of aa is 0011, then we would replace all occurrences of aa by a and vice versa. In general, we rename the registers such that the registers that occur most often have the shortest binary encodings and those that occur least often have the longest binary encoding. At the end of this stage, we have strict Chi-Kou or Elena code. 2. The second stage is to convert strict code into a binary string. We translate each instruction to its binary equivalent by applying the encoding to the special characters and register names. At the end of this step, we output the binary string corresponding to the original program. 5.1 Simple encoding A simple encoding is that each character from, &, =, +,!, %, a,..., h is mapped onto a unique binary string of length 4. If we want to use register names which 9

10 are strings of characters from a,..., z, we may use an 8 bit encoding. Each nonnegative integer is mapped onto its equivalent binary representation of the form (1 + 0) + 0. Then given an instruction, we replace each character of the instruction by its 4-bit (or 8-bit) encoding and obtain the binary string corresponding to the instruction. Each integer constant is similarly replaced by its equivalent binary representation. 5.2 Prefix-free encoding The paper [2] provides a prefix-free encoding. In this encoding each register and any non-negative integers are assigned with prefix-free codes. The encoding for special characters is given below (ɛ is the empty string): special characters code, ɛ & 01 = ! 110 % 100 For registers, the prefix-free code code 1 = {0 x 1x x (0 + 1) + } is used i.e. the n th register corresponds to 0 xn 1xn where x n is the n th non-empty binary string in the length lexicographic order of binary strings. The codes for the first 5 registers are shown below: register code 1 R R R R R For non-negative integers, the prefix free code code 2 = {1 x 0x x (0+1) + } is used i.e. the n 0 corresponds to 0 xn+1 1x n+1 where x n+1 is the n + 1 th nonempty binary string in the length lexicographic order of binary strings. The codes for the first 5 non-negative integers are shown below: integer code

11 The instructions are coded as follows: 1. &R1, R2 is coded in two different ways depending on R2: 01code 1 (R1)code i (R2) where i = 1 if R2 is a register and i = 2 if it is an integer. 2. +R1, R2 is coded in two different ways depending on R2: 111code 1 (R1)code i (R2) where i = 1 if R2 is a register and i = 2 if it is an integer. 3. = R1, R2, R3 is coded in four different ways depending on the data types of R2 and R3: 00code 1 (R1)code i (R2)code j (R3) where i = 1 if R2 is a register and i = 2 if it is an integer, j = 1 if R3 is a register and j = 2 if it is an integer. 4.!R1 is coded by: 110code 1 (R1) 5. % is coded by Syntax checker and translator The syntax checker and translator is intended to carry out the process described in section 5. The input is either a strict or relaxed program (written in Elena/Chi- Kou). If the input is a strict program, the tool may perform the following actions as specified by the user: 1. Generate binary code after renaming the registers if specified (lexicographic or by frequency). If the input is a relaxed program (in either Chi-Kou or Elena), the tool may perform the following actions as specified by the user: 1. Generate strict code after performing the renaming of registers (if specified). 2. Generate binary code after performing the renaming of registers (if specified). In particular the following options will be provided by the tool: 1. i: Specify the input file. The default is stdin. 2. l: Specify the dialect of the input. Legal values are 1 for Chi-Kou and 2 for Elena. Default is Chi-Kou. 3. s: Specify whether the input is strict or not. Default is that the input is not strict. 4. o: Specify the format of the output. Legal values are 1 for strict output and 2 for binary. Default is binary. If input is strict, the only legal value is 2. 11

12 5. e: Specify the encoding type if the output is desired in binary. 1 for simple encoding and 2 for prefix-free. Default is simple. Must not be specified if input is relaxed and output is strict. 6. p: Specify the optimization to be carried out. 1 for lexicographic register ordering and 2 for frequency based register ordering. Default is no optimization. 7. u: Specify whether or not temporary registers are to be treated as unique in every subroutine. Default is not to be treated as unique. 8. a: Specify whether the output is to be aligned with the input. If output is strict, the alignment is exactly the same as the input. If output is binary every instruction is printed on a new line in Chi-Kou. In Elena, the detailed translation of each instruction to binary (including number of bits) is printed out. Default is not aligned. 9. f: This option specifies the file to which the output should be written. The default is to write the output to the standard output. 10. q: Specify whether line numbering starts from 0 or 1 in Elena. If specified, numbering starts from 1, otherwise h : Print information about the options and valid values and then exit. 6.1 Installation In order to use the translator tool, the user s machine must have Java SE 6 1 or higher installed. The tool is packaged as a jar file named translator.jar. This file may be placed in any directory in the user s file system. The tool needs to be run using the command line. On the Windows 7 operating system, the program cmd needs to be used and this may be found by clicking on the start button and then searching for cmd. Once cmd has started, the user needs to change the working directory to the one where translator.jar is located (by using a built-in command like cd) and then use the tool by invoking the command java -jar translator.jar followed by valid options. On the Mac OSX operating system, the tool needs to be run using the Terminal application. This application may be found in /Applications/Utilities/ Terminal. Again the user needs to change the working directory to the one where translator.jar is located (by using a built-in command like cd) and then use the tool by invoking the command java -jar translator.jar followed by valid options. Regression tests may be used to check if the installation is working correctly. In order to run the regression tests, the jar file named tester.jar should be run by using the command java -jar translator.jar followed by the name of the xml file containing the list of tests. A list of tests (tests.xml) is provided with the distribution and may be modified to add/remove tests. See the appendix A to see how to add/remove tests from tests.xml. 1 The Java runtime may be downloaded from the following URL: 12

13 6.2 Examples of usage Here we provide some examples of how to use the various options of the translator tool. We assume that java is included in the system s PATH environment variable. Consider the following code: &ah, L6 =b,ah,f &b, Sub L6: =r0, 0, d Sub: +ah, 1 &r0, L7 =ah, 1, cf L7:% We assume that the above code is saved in a file named test.txt. The following examples show some ways in which translator.jar may be used on this code: 1. If we want interpret the input as Chi-Kou code and output strict code with no optimization, we may use the following command: java -jar translator.jar -i test.txt -l 1 -o 1. The output is printed to stdout (since the -f option is not specified). The output is shown below: &ah,11 =b,ah,f &b,100 =cg,0,d +ah,1 &cg,111 =ah,1,cf % Note that the temporary register r0 has been replaced by the global register cg. Suppose the output is saved in a file called test1.txt. 2. If we want to convert the above Chi-Kou strict code to binary, we may use the following command: java -jar translator.jar -i test1.txt -l 1 -s The -s option is to indicate that the input is to be interpreted as strict Chi-Kou code. The simple encoding is used by default. The output of this command is shown below:

14 3. If we want to interpret the input as Elena code and output strict code with no optimization, we may use the following command: java -jar translator.jar -i test.txt -l 2 -o 1. The output is printed to stdout (since the -f option is not specified). The output is shown below: 0 & ah 3 1 = b ah f 2 & b 4 3 = cg 0 d 4 + ah 1 5 & cg 7 6 = ah 1 cf 7 % We may convert the above code (assumed to be saved to test2.txt) to binary by using the following command: java -jar translator.jar -i test2.txt -l 2 -s. 4. If we want to convert the code in test.txt to binary by using the prefix-free encoding and no optimization, we may use the following command: java -jar -i test.txt -o 2 -e 2. Note that this command interprets the input as being in Chi-Kou (since -l is not specified). The option -e 2 specifies that the prefix-free encoding is desired. The output is shown below: If we want to interpret the code in test.txt as Elena code and convert it to binary using the the prefix-free encoding and with frequency based reordering of registers, we may use the following command: java -jar translator.jar -i test.txt -l 2 -o 2 -e 2 -p 2 The -p 2 option specifies that the frequency based ordering is desired. The output is shown below: If we want to covert the code in test.txt to strict code and make sure that the temporary registers are named uniquely in each subroutine, we may use the following command: java -jar translator.jar -i test.txt -l 2 -o 1 -u The -u option specifies that the temporary registers should be assigned unique names. The output is shown below: 14

15 0 & ah 3 1 = b ah f 2 & b 4 3 = cg 0 d 4 + ah 1 5 & ch 7 6 = ah 1 cf 7 % Note that the register r0 is renamed to cg in the main subroutine and ch in the Sub subroutine. 7. If we want to to start the line numbering from 1 (instead of 0) (interpreting the input as Elena code), we may use the following command: java -jar translator.jar -i test.txt -l 2 -o 1 -q The -q option specifies that that line numbering should start from 1. The output is shown below: 1 & ah 4 2 = b ah f 3 & b 5 4 = cg 0 d 5 + ah 1 6 & cg 8 7 = ah 1 cf 8 % 8. If we want to interpret the input as Elena code and print the detailed information about its conversion to binary we may use the following command: java -jar translator.jar -i test.txt -l 2 -e 2 -a The option -a used when converting Elena code to binary prints detailed information about the conversion of the input code to binary. The output is shown below: Instruction number=0 & 01 ah The number of bits 10 Instruction number=1 = 00 b 011 ah 010 f

16 The number of bits 13 Instruction number=2 & 01 b The number of bits 10 Instruction number=3 = 00 cg d The number of bits 15 Instruction number= ah The number of bits 9 Instruction number=5 & 01 cg The number of bits 14 Instruction number=6 = 00 ah cf The number of bits 13 Instruction number=7 % 100 The number of bits 3 Program size If we want to interpret the input as Chi-Kou code and convert to binary while maintaining alignment with the input, we may use the following command: java -jar -i test.txt -e 2 -a The following output is produced: 16

17 Example of a complete relaxed Chi-Kou program and its strict form The following is the complete program for the Goldbach s conjecture taken from [1]. &a,goldbach =b,c,a // b=c=0 so jumps to start of Goldbach algorithm // Cmp(a,b) returns 1 if a<b, 0 if a=b, or 2 if a>b Cmp: &d,0 =a,b,c +d,1 &e,a &f,b &g,l1 &h,l2 L1: +e,1 +f,1 =e,b,c =f,a,h =a,a,g L2: +d,1 // Sub(a,b) returns a-b, where we assume a>=b Sub: &d,0 =a,b,c &e,b &f,l1 L1: +d,1 +e,1 =a,e,c =a,a,f // Mul(a,b) returns a*b 17

18 Mul: &d,0 =a,0,c =b,0,c &e,l1 &f,1 +d,a L1: =f,b,c +f,1 +d,a =a,a,e // Div(a,b) returns integer floor of a/b, assumes b>0 Div: &g,l1 &h,l2 &aa,a // copy of a (variable not used in Cmp & Mul) &ab,b // copy of b &ac,c // copy of c &ad,1 // initial answer &c,l0 &d,cmp =a,a,d // call Cmp(a,b) L0: &c,aa =d,0,g =d,2,h &d,0 // else a < b so return 0 L1: &d,1 // a=b so return 1 L2: &c,l5 &ae,mul &a,ad =a,a,ae L5: &a,d // just computed ad*b &b,aa &c,l6 &ae,cmp =a,a,ae // call Cmp(ad*b,a) L6: &b,ab // reset b &ae,l3 =d,1,ae &ae,l4 =a,a,ae L3: +ad,1 // still < =a,a,h L4: &d,ad 18

19 &a,aa // unpop input parameters &b,ab &c,ac // Mod(a,b) returns a mod b, assumes b>0 Mod: &af,a // copy of parameters &ag,b &c,l0 &d,div =a,a,d // call Div(a,b) L0: &a,d &c,l1 &d,mul =a,a,d // call Mul(a/b,b) L1: &a,af &b,d &c,l2 &d,sub =a,a,d // call Sub(a,[a/b]*b) L2: &b,ag // isprime(a) where a >= 2 isprime: &d,0 &ah,a // parameter copy &ba,l1 &bb,l2 &bc,c &b,2 L1: =b,ah,bb // trial reached so a is prime &bd,mod &c,l3 =a,a,bd // call Mod(a,b) L3: &c,bc =d,0,c // divisible by b so not prime +b,1 =a,a,ba L2: &d,1 &a,ah // start of Goldbach Conjecture testing program Goldbach: &be,2 L0: +be,2 // enumeration of all even integers >= 4 19

20 &bf,2 // enumeration of all primes bf >= 2 and bf < be &a,bf &c,l1 &bg,isprime =a,a,bg L1: &e,l3 =d,1,e // if bf is prime L2:+bf,1 // else increment &d,l6 =bf,be,d // found counter example &a,bf &c,l1 =a,a,bg // check is prime again L3: &bh,bf // enumeration of all primes bh >= bf and bh < be L5: &ca,bf +ca,bh // sum of primes &cb,l0 =be,ca,cb // found sum, test next be L7: +bh,1 &cb,l2 =bh,be,cb // try next bf &c,l4 &a,bh =a,a,bg L4: &e,l5 =d,1,e // if bh is prime &e,l7 =a,a,e // else increment bh L6: % The following is the strict code corresponding to the relaxed code by using the simple encoding: &a, =b,c,a &d,0 =a,b,c +d,1 &e,a &f,b &g,1001 &h,1110 +e,1 +f,1 =e,b,c =f,a,h =a,a,g 20

21 +d,1 &d,0 =a,b,c &e,b &f, d,1 +e,1 =a,e,c =a,a,f &d,0 =a,0,c =b,0,c &e,11110 &f,1 +d,a =f,b,c +f,1 +d,a =a,a,e &g, &h, &aa,a &ab,b &ac,c &ad,1 &c, &d,10 =a,a,d &c,aa =d,0,g =d,10,h &d,0 &d,1 &c, &ae,11000 &a,ad =a,a,ae &a,d &b,aa &c, &ae,10 =a,a,ae 21

22 &b,bb &ae, =d,1,ae &ae, =a,a,ae +ad,1 =a,a,h &d,ad &a,aa &b,ab &c,ac &af,a &ag,b &c, &d, =a,a,d &a,d &c, &d,11000 =a,a,d &a,af &b,d &c, &d,10000 =a,a,d &b,ag &d,0 &ah,a &ba, &bb, &bc,c &b,10 =b,ah,bb &bd, &c, =a,a,bd &c,bc =d,0,c +b,1 =a,a,ba &d,1 &a,ah 22

23 &be,10 +be,10 &bf,10 &a,bf &c, &bg, =a,a,bg &e, =d,1,e +bf,1 &d, =bf,be,d &a,bf &c, =a,a,bg &bh,bf &ca,bf +ca,bh &cb, =be,ca,cb +bh,1 &cb, =bh,be,cb &c, &a,bh =a,a,bg &e, =d,1,e &e, =a,a,e % References 1. C.S. Calude, E. Calude, M.J. Dinneen, A New Measure of the Difficulty of Problems, CDMTS Research report series, CDMTS-277, retrieved from C.S. Calude, E. Calude, The Complexity of Mathematical Problems: An Overview of Results and Open Problems, CDMTS Research report series, CDMTS-410, retrieved from M.J. Dinneen, A program sized complexity measure for mathematical problems and conjectures, Intl. Workshop in Theoretical Computer Science, WTCS Appendix A: Adding/removing tests to tests.xml The file tests.xml specifies the following items: 23

24 1. The directory in which the tests are located. This is specified by setting the attribute dir of the element <test-list>. The full path needs to be specified here. 2. The directory in which translator.jar is located. This is specified by setting the attribute tool-dir of the element <test-list>. The full path needs to be specified here. 3. A list of tests. These are specified by using the <test> element. This element must have an <options> element, an <input> element and <output> element. The <options> element specifies the options which translator.jar should be run with, the <input> element specifies the input file within the directory given by dir on which the tool must be run. The <output> element specifies the type of output expected (by setting the attribute type to either err or output) and the file within dir with which the output of translator.jar must be compared with. The tester.jar application takes such an xml file as an argument and runs each test as specified (by the <option>, <input> and <output> elements). If the output of a test matches the one specified by the file stated in the <output> element of that test, then the test is declared as passed, otherwise the test is declared as failed. The tester.jar application reports the command run for each test and whether that test passed or failed. To add a test, a valid <test> element must be added to the xml file. Similarly a test can be removed by deleting the corresponding <test> element from the xml file. A set of tests is included in the distribution of the software (in bin/tests). 9 Appendix B: Another strict version of the Elena programming language The strict version of the Elena programming language we implemented earlier had the following specification. Again note that R2, R3 are may be either registers or binary constants whereas R1 is always a register. Also registers may only be named by alphabetic words (not alphanumeric). 1. =R1, R2, R3. This instruction compares the contents of the register R1 with contents of R2 and if identical, the program jumps to the R3-th instruction. If R3 = 0, the control is transferred to the first line of the program. If the contents of R1, R2 are not identical, then the execution continues with the next instruction. Note that an illegal branch error results if the contents of R3 are outside the scope of the program. 2. &R1, R2. This instruction replaces the contents of the register R1 by the contents of R2 (register or binary constant). 3. +R1, R2. The contents of register R1 are replaced by the sum of the contents of R1 and R2 (register or binary constant). 4.!R1. One bit is read in (from the input) and the contents of the register R1 are replaced by this bit i.e. the numerical value of R1 becomes 0 or 1 after this instruction. An attempt to read past the last data bit is a run-time error. 24

25 5. %. This is the last instruction of each Elena program and represents the end of the program. Raw data follows this instruction, It halts the execution in two possible states: either successfully or with an under-read error. We refer to this instruction as the HALT instruction for convenience. The strict version of Elena described above is no longer supported by the translator. 10 Appendix C: Building the project from the source code In order to build the project from the source code, first checkout the source code from dev projects/projects/applications/translator/trunk and then follow the instructions in the file readme.txt. 25

The Complexity of Goldbach s Conjecture and Riemann s Hypothesis

The Complexity of Goldbach s Conjecture and Riemann s Hypothesis CDMTCS Research Report Series The Complexity of Goldbach s Conjecture and Riemann s Hypothesis Elena Calude Massey University at Albany, NZ CDMTCS-370 August 2009 Centre for Discrete Mathematics and Theoretical

More information

Lec-5-HW-1, TM basics

Lec-5-HW-1, TM basics Lec-5-HW-1, TM basics (Problem 0)-------------------- Design a Turing Machine (TM), T_sub, that does unary decrement by one. Assume a legal, initial tape consists of a contiguous set of cells, each containing

More information

Chapter 1 Preliminaries

Chapter 1 Preliminaries Chapter 1 Preliminaries This chapter discusses the major classes of programming languages and the relationship among them. It also discusses the binary and the hexadecimal number systems which are used

More information

SPAREPARTSCATALOG: CONNECTORS SPARE CONNECTORS KTM ART.-NR.: 3CM EN

SPAREPARTSCATALOG: CONNECTORS SPARE CONNECTORS KTM ART.-NR.: 3CM EN SPAREPARTSCATALOG: CONNECTORS ART.-NR.: 3CM3208201EN CONTENT SPARE CONNECTORS AA-AN SPARE CONNECTORS AO-BC SPARE CONNECTORS BD-BQ SPARE CONNECTORS BR-CD 3 4 5 6 SPARE CONNECTORS CE-CR SPARE CONNECTORS

More information

SPARE CONNECTORS KTM 2014

SPARE CONNECTORS KTM 2014 SPAREPARTSCATALOG: // ENGINE ART.-NR.: 3208201EN CONTENT CONNECTORS FOR WIRING HARNESS AA-AN CONNECTORS FOR WIRING HARNESS AO-BC CONNECTORS FOR WIRING HARNESS BD-BQ CONNECTORS FOR WIRING HARNESS BR-CD

More information

Compiler Construction

Compiler Construction Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

More information

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition

More information

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1 Version 1 1. (24 Points) Show the routing tables for routers A, B, C, and D. Make sure you account for traffic to the Internet. NOTE: Router E should only be used for Internet traffic. Router A Router

More information

Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site

Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site Escalation rate 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 0001 AA01 Administrative Assistant Level I $51.00

More information

CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria

CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria CHAPTER TWO LANGUAGES By Dr Zalmiyah Zakaria Languages Contents: 1. Strings and Languages 2. Finite Specification of Languages 3. Regular Sets and Expressions Sept2011 Theory of Computer Science 2 Strings

More information

2-Type Series Pressurized Closures

2-Type Series Pressurized Closures 2-Type Series Pressurized Closures A complete pressure tight reenterable closure system for enclosing spliced connections of communications cables in a wide variety of applications. The 2-type Closure

More information

22ND CENTURY_J1.xls Government Site Hourly Rate

22ND CENTURY_J1.xls Government Site Hourly Rate Escalation rate 000 AA0 Administrative Assistant Level I 000 AA0 Administrative Assistant Level II 000 AB0 Application Engineer Level I 000 AB0 Application Engineer Level II 000 AC0 Application Programmer

More information

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory Proof Techniques Alphabets, Strings, and Languages Foundations of Computer Science Theory Proof By Case Enumeration Sometimes the most straightforward way to prove that a property holds for all elements

More information

C1098 JPEG Module User Manual

C1098 JPEG Module User Manual C1098 JPEG Module User Manual General Description C1098 is VGA camera module performs as a JPEG compressed still camera that can be attached to a wireless or PDA host. Users can send out a snapshot command

More information

2.6 BOOLEAN FUNCTIONS

2.6 BOOLEAN FUNCTIONS 2.6 BOOLEAN FUNCTIONS Binary variables have two values, either 0 or 1. A Boolean function is an expression formed with binary variables, the two binary operators AND and OR, one unary operator NOT, parentheses

More information

CIS-331 Fall 2014 Exam 1 Name: Total of 109 Points Version 1

CIS-331 Fall 2014 Exam 1 Name: Total of 109 Points Version 1 Version 1 1. (24 Points) Show the routing tables for routers A, B, C, and D. Make sure you account for traffic to the Internet. Router A Router B Router C Router D Network Next Hop Next Hop Next Hop Next

More information

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] 1 What is Lexical Analysis? First step of a compiler. Reads/scans/identify the characters in the program and groups

More information

Solutions to Homework 10

Solutions to Homework 10 CS/Math 240: Intro to Discrete Math 5/3/20 Instructor: Dieter van Melkebeek Solutions to Homework 0 Problem There were five different languages in Problem 4 of Homework 9. The Language D 0 Recall that

More information

Intel 8086: Instruction Set

Intel 8086: Instruction Set IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction

More information

4. Specifications and Additional Information

4. Specifications and Additional Information 4. Specifications and Additional Information AGX52004-1.0 8B/10B Code This section provides information about the data and control codes for Arria GX devices. Code Notation The 8B/10B data and control

More information

DETAIL SPECIFICATION SHEET

DETAIL SPECIFICATION SHEET INCH-POUND MIL-DTL-55302/128D 18 April 2013 SUPERSEDING MIL-DTL-55302/128D 4 June 2004 DETAIL SPECIFICATION SHEET CONNECTORS, PRINTED CIRCUIT SUBASSEMBLY AND ACCESSORIES: RECEPTACLE, DOUBLE ROW, 4 THROUGH

More information

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Section 1.7 Sequences, Summations Cardinality of Infinite Sets Section 1.7 Sequences, Summations Cardinality of Infinite Sets Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and

More information

UNIT 4. Modular Programming

UNIT 4. Modular Programming 1 UNIT 4. Modular Programming Program is composed from several smaller modules. Modules could be developed by separate teams concurrently. The modules are only assembled producing.obj modules (Object modules).

More information

Introduction to MiniSim A Simple von Neumann Machine

Introduction to MiniSim A Simple von Neumann Machine Math 121: Introduction to Computing Handout #19 Introduction to MiniSim A Simple von Neumann Machine Programming languages like C, C++, Java, or even Karel are called high-level languages because they

More information

Section 2.4 Sequences and Summations

Section 2.4 Sequences and Summations Section 2.4 Sequences and Summations Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and {0, 1, 2, 3,..., k} {1,

More information

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction CSc 520 Principles of Programming Languages 26 : Control Structures Introduction Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0 6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and

More information

CIS-331 Spring 2016 Exam 1 Name: Total of 109 Points Version 1

CIS-331 Spring 2016 Exam 1 Name: Total of 109 Points Version 1 Version 1 Instructions Write your name on the exam paper. Write your name and version number on the top of the yellow paper. Answer Question 1 on the exam paper. Answer Questions 2-4 on the yellow paper.

More information

CHAPTER TWO. . Therefore the oblong number n(n + 1) is double the triangular number T n. , and the summands are the triangular numbers T n 1 and T n.

CHAPTER TWO. . Therefore the oblong number n(n + 1) is double the triangular number T n. , and the summands are the triangular numbers T n 1 and T n. CHAPTER TWO 1. Since AB BC; since the two angles at B are equal; and since the angles at A and C are both right angles, it follows by the angle-side-angle theorem that EBC is congruent to SBA and therefore

More information

Areas of Difficulty Requiring Help or Assistance in the Ejs User Interface

Areas of Difficulty Requiring Help or Assistance in the Ejs User Interface Areas of Difficulty Requiring Help or Assistance in the Ejs User Interface The following describes the basic Ejs UI behavior and areas needing help. It is necessary to understand a bit about the Ejs UI

More information

One subset of FEAL, called FEAL-NX, is N round FEAL using a 128-bit key without key parity.

One subset of FEAL, called FEAL-NX, is N round FEAL using a 128-bit key without key parity. FEAL-NX SPECIFICATIONS 1 Introduction 1.1 Outline of the FEAL-NX cipher FEAL, the Fast Data Encipherment Algorithm, is a 64-bit block cipher algorithm that enciphers 64-bit plaintexts into 64-bit ciphertexts

More information

3-ADDRESS CODE SIMULATOR DOCUMENTATION

3-ADDRESS CODE SIMULATOR DOCUMENTATION 3-ADDRESS CODE SIMULATOR DOCUMENTATION A) SIMULATOR OVERVIEW 1) The 3-address code simulator is a two-pass simulator. The first scans and interprets the instruction and the arguments. The second pass executes

More information

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

CIS-331 Exam 2 Fall 2015 Total of 105 Points Version 1

CIS-331 Exam 2 Fall 2015 Total of 105 Points Version 1 Version 1 1. (20 Points) Given the class A network address 117.0.0.0 will be divided into multiple subnets. a. (5 Points) How many bits will be necessary to address 4,000 subnets? b. (5 Points) What is

More information

Integers and Mathematical Induction

Integers and Mathematical Induction IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about

More information

Release 0.8. Multi-Purpose Light Unit Technical Reference Manual

Release 0.8. Multi-Purpose Light Unit Technical Reference Manual Release 0.8 Multi-Purpose Light Unit Technical Reference Manual INTRODUCTION Introduction The Multi-Purpose Light unit is a multi-function DCC decoder that supports the following: DCC Characteristics 14

More information

Counting Words Using Hashing

Counting Words Using Hashing Computer Science I Counting Words Using Hashing CSCI-603 Lecture 11/30/2015 1 Problem Suppose that we want to read a text file, count the number of times each word appears, and provide clients with quick

More information

Module 1: Information Representation I -- Number Systems

Module 1: Information Representation I -- Number Systems Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1305 Intro to Computer Technology 1 Module 1: Information Representation I -- Number Systems Objectives: Learn

More information

No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation.

No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation. [MS-FSSHTTPD]: Intellectual Property Rights Notice for Open Specifications Documentation Technical Documentation. Microsoft publishes Open Specifications documentation for protocols, file formats, languages,

More information

SN8F5000 Family Instruction Set

SN8F5000 Family Instruction Set SONiX Technology Co., Ltd. 8051-based Microcontroller 1 Overview SN8F5000 is 8051 Flash Type microcontroller supports comprehensive assembly instructions and which are fully compatible with standard 8051.

More information

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited

More information

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program. Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language

More information

Systems/DBG Debugger Version 2.20

Systems/DBG Debugger Version 2.20 Systems/DBG Debugger Version 2.20 Copyright c 2018, Dignus, LLC Systems/DBG Debugger Version 2.20 i Copyright c 2018 Dignus LLC, 8378 Six Forks Road Suite 203, Raleigh NC, 27615. World rights reserved.

More information

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions 1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions

More information

csci 210: Data Structures Stacks and Queues in Solution Searching

csci 210: Data Structures Stacks and Queues in Solution Searching csci 210: Data Structures Stacks and Queues in Solution Searching 1 Summary Topics Using Stacks and Queues in searching Applications: In-class problem: missionary and cannibals In-class problem: finding

More information

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08 CS412/413 Introduction to Compilers Tim Teitelbaum Lecture 2: Lexical Analysis 23 Jan 08 Outline Review compiler structure What is lexical analysis? Writing a lexer Specifying tokens: regular expressions

More information

Transactions in Euclidean Geometry

Transactions in Euclidean Geometry Transactions in Euclidean Geometry Volume 207F Issue # 2 Table of Contents Title Author Construction of a Rhombus Micah Otterbein Kite Construction Emily Carstens Constructing Kites Grant Kilburg Star

More information

ENGI 4421 Counting Techniques for Probability Page Example 3.01 [Navidi Section 2.2; Devore Section 2.3]

ENGI 4421 Counting Techniques for Probability Page Example 3.01 [Navidi Section 2.2; Devore Section 2.3] ENGI 4421 Coutig Techiques fo Pobability Page 3-01 Example 3.01 [Navidi Sectio 2.2; Devoe Sectio 2.3] Fou cads, labelled A, B, C ad D, ae i a u. I how may ways ca thee cads be daw (a) with eplacemet? (b)

More information

13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 2011 Automata Theory EUR solutions

13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 2011 Automata Theory EUR solutions 13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 011 Automata Theory EUR solutions Problem 1 (5 points). Prove that any surjective map between finite sets of the same cardinality is a

More information

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic: Pointer Manipulations Pointer Casts and Data Accesses Viewing Memory The contents of a block of memory may be viewed as a collection of hex nybbles indicating the contents of the byte in the memory region;

More information

Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

More information

Lecture 6,

Lecture 6, Lecture 6, 4.16.2009 Today: Review: Basic Set Operation: Recall the basic set operator,!. From this operator come other set quantifiers and operations:!,!,!,! \ Set difference (sometimes denoted, a minus

More information

Language Reference Manual simplicity

Language Reference Manual simplicity Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna

More information

[MS-FSSHTTPD]: Binary Data Format for File Synchronization via SOAP. Intellectual Property Rights Notice for Open Specifications Documentation

[MS-FSSHTTPD]: Binary Data Format for File Synchronization via SOAP. Intellectual Property Rights Notice for Open Specifications Documentation [MS-FSSHTTPD]: Intellectual Property Rights Notice for Open Specifications Documentation Technical Documentation. Microsoft publishes Open Specifications documentation ( this documentation ) for protocols,

More information

Program Construction and Data Structures Course 1DL201 at Uppsala University Autumn 2010 / Spring 2011 Homework 6: Data Compression

Program Construction and Data Structures Course 1DL201 at Uppsala University Autumn 2010 / Spring 2011 Homework 6: Data Compression Program Construction and Data Structures Course 1DL201 at Uppsala University Autumn 2010 / Spring 2011 Homework 6: Data Compression Prepared by Pierre Flener Lab: Thursday 17 February 2011 Submission Deadline:

More information

2.2 Syntax Definition

2.2 Syntax Definition 42 CHAPTER 2. A SIMPLE SYNTAX-DIRECTED TRANSLATOR sequence of "three-address" instructions; a more complete example appears in Fig. 2.2. This form of intermediate code takes its name from instructions

More information

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Lexical Analysis Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Phase Ordering of Front-Ends Lexical analysis (lexer) Break input string

More information

9/25/ Software & Hardware Architecture

9/25/ Software & Hardware Architecture 8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called

More information

RS 232 PINOUTS. 1. We use RJ12 for all of our RS232 interfaces (Link-2-Modbus & Link-2-PC- Serial/RS232). The diagram below shows our pin out.

RS 232 PINOUTS. 1. We use RJ12 for all of our RS232 interfaces (Link-2-Modbus & Link-2-PC- Serial/RS232). The diagram below shows our pin out. RS 232 PINOUTS 1. We use RJ12 for all of our RS232 interfaces (Link-2-Modbus & Link-2-PC- Serial/RS232). The diagram below shows our pin out. 2. A DB9 Female to RJ12 Female Serial/Terminal Modular Adaptor

More information

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines Sample Problem 1 Assume the following memory setup: Virtual addresses are 20 bits wide Physical addresses are 15 bits wide The page size if 1KB (2 10 bytes) The TLB is 2-way set associative, with 8 total

More information

Overview of Compiler. A. Introduction

Overview of Compiler. A. Introduction CMPSC 470 Lecture 01 Topics: Overview of compiler Compiling process Structure of compiler Programming language basics Overview of Compiler A. Introduction What is compiler? What is interpreter? A very

More information

Nim-Regularity of Graphs

Nim-Regularity of Graphs Nim-Regularity of Graphs Nathan Reading School of Mathematics, University of Minnesota Minneapolis, MN 55455 reading@math.umn.edu Submitted: November 24, 1998; Accepted: January 22, 1999 Abstract. Ehrenborg

More information

ECE3120: Computer Systems Hardware & Software Development Tools

ECE3120: Computer Systems Hardware & Software Development Tools ECE3120: Computer Systems Hardware & Software Development Tools Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Using the

More information

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers

More information

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus) Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.

More information

Mnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C

Mnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C ARITHMETIC AND LOGICAL GROUPS 6-1 Arithmetic and logical groups: The arithmetic group includes instructions for the addition, subtraction, multiplication, and division operations. The state that results

More information

Microprocessors (A) DOS Services

Microprocessors (A) DOS Services 1 Services 2 System Calls Operating System services: Disk and file system management Screen display and printing Keyboard entry Other I/O management Date and time Program run and terminate Command arguments

More information

Don t Let Uncle Sam Pick Your Pocket Again. Plan Now for next year. Call for a free half-hour consultation.

Don t Let Uncle Sam Pick Your Pocket Again.  Plan Now for next year. Call for a free half-hour consultation. Don t Let Uncle Sam Pick Your Pocket Again www.mayclincpa.com Plan Now for next year. Call for a free half-hour consultation. 6.)&< &< *;75&5*6 4+ 4-3*68 &8 &< &11 )&< :: =

More information

8088/8086 Programming Integer Instructions and Computations

8088/8086 Programming Integer Instructions and Computations Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction

More information

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

Concepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens

Concepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens Concepts Introduced in Chapter 3 Lexical Analysis Regular Expressions (REs) Nondeterministic Finite Automata (NFA) Converting an RE to an NFA Deterministic Finite Automatic (DFA) Lexical Analysis Why separate

More information

ECHO Process Instrumentation, Inc. Modbus RS485 Module. Operating Instructions. Version 1.0 June 2010

ECHO Process Instrumentation, Inc. Modbus RS485 Module. Operating Instructions. Version 1.0 June 2010 ECHO Process Instrumentation, Inc. Modbus RS485 Module Operating Instructions Version 1.0 June 2010 ECHO Process Instrumentation, Inc. PO Box 800 Shalimar, FL 32579 PH: 850-609-1300 FX: 850-651-4777 EM:

More information

RSL Reference Manual

RSL Reference Manual RSL Reference Manual Part No.: Date: April 6, 1990 Original Authors: Klaus Havelund, Anne Haxthausen Copyright c 1990 Computer Resources International A/S This document is issued on a restricted basis

More information

Chapter 16: Direct Conversions Between EBCDIC and Fullword Formats

Chapter 16: Direct Conversions Between EBCDIC and Fullword Formats Chapter 16: Direct Conversions Between EBCDIC and Fullword Formats This chapter presents a discussion of direct conversions between digits in the EBCDIC format and binary integers stored in the 32 bit

More information

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1 Introduction to Automata Theory BİL405 - Automata Theory and Formal Languages 1 Automata, Computability and Complexity Automata, Computability and Complexity are linked by the question: What are the fundamental

More information

CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total.

CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total. CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total September 7, 2011 Assignment 3, Posted on: 9/6 Due: 9/15 Thursday 11:59pm 1. (20

More information

!! " # $%! "! &' $ (!!

!!  # $%! ! &' $ (!! " # $% " &' $ ( & ' ) * # +, -.% /.-01234 + +315 23 +6 ++17 $ 2+68% )99*. + )99* 1 )99*, /+.% )99*-58 1 ( #$ :5 ; &' @" +#1 7 +..%30 8,,1 8%4 #.>)99(@> & ' @ ) $,. # %ABB * 77 (9C:#+

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

MST & Shortest Path -Prim s -Djikstra s

MST & Shortest Path -Prim s -Djikstra s MST & Shortest Path -Prim s -Djikstra s PRIM s - Minimum Spanning Tree - A spanning tree of a graph is a tree that has all the vertices of the graph connected by some edges. - A graph can have one or more

More information

Non-deterministic Finite Automata (NFA)

Non-deterministic Finite Automata (NFA) Non-deterministic Finite Automata (NFA) CAN have transitions on the same input to different states Can include a ε or λ transition (i.e. move to new state without reading input) Often easier to design

More information

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont. Announcements CS43: Discrete Structures Strong Induction and Recursively Defined Structures Işıl Dillig Homework 4 is due today Homework 5 is out today Covers induction (last lecture, this lecture, and

More information

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( ) 6. Combinational Circuits George Boole (85 864) Claude Shannon (96 2) Signals and Wires Digital signals Binary (or logical ) values: or, on or off, high or low voltage Wires. Propagate digital signals

More information

Week /8086 Microprocessor Programming I

Week /8086 Microprocessor Programming I Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any

More information

NWG/RFC# 640 JBP NJN 5-JUN-74 16: Revised FTP Reply Codes. Jon Postel 19 JUN 75. Revised FTP Reply Codes 1

NWG/RFC# 640 JBP NJN 5-JUN-74 16: Revised FTP Reply Codes. Jon Postel 19 JUN 75. Revised FTP Reply Codes 1 Revised FTP Reply Codes Jon Postel 19 JUN 75 Revised FTP Reply Codes 1 This document describes a revised set of reply codes for the File Transfer Protocol. 2 The aim of this revision is to satisfy the

More information

$%&#!#$!!!#'((#!)*+"!!,!#*+- ) %() (. %( ) //. 0 1 ) (2.

$%&#!#$!!!#'((#!)*+!!,!#*+- ) %() (. %( ) //. 0 1 ) (2. !!"##! $%&#!#$!!!#'((#!)*+"!!,!#*+- ) %() (. %( ) //. 0 1 ) (2. / 3 /!. 4 5 5.. 0 )67 )" ) +-889:+ 5 7777777777 77777777 * )67* )" ).0; ((, ((

More information

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC This update to the AppleShare PC User's Guide discusses AppleShare PC support for the use of international character sets, paper sizes, and date

More information

Principles of Compiler Design

Principles of Compiler Design Principles of Compiler Design Code Generation Compiler Lexical Analysis Syntax Analysis Semantic Analysis Source Program Token stream Abstract Syntax tree Intermediate Code Code Generation Target Program

More information

Shell CSCE 314 TAMU. Haskell Functions

Shell CSCE 314 TAMU. Haskell Functions 1 CSCE 314: Programming Languages Dr. Dylan Shell Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions can

More information

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. Other Automata We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. From all of this information we decide what state

More information

(Not Quite) Minijava

(Not Quite) Minijava (Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

第六屆 ACM ICPC 全國私立大專校院程式競賽. National Contest for Private Universities, Taiwan 2016 競賽題目

第六屆 ACM ICPC 全國私立大專校院程式競賽. National Contest for Private Universities, Taiwan 2016 競賽題目 第六屆 ACM ICPC 全國私立大專校院程式競賽 National Contest for Private Universities, Taiwan 016 競賽題目 Problem 1: Maximum Subsequence Sum Problem (Time Limit: 3 seconds) Given a sequence containing both negative and positive

More information

Power Set of a set and Relations

Power Set of a set and Relations Power Set of a set and Relations 1 Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}}

More information

Communications guide. Line Distance Protection System * F1* GE Digital Energy. Title page

Communications guide. Line Distance Protection System * F1* GE Digital Energy. Title page Title page GE Digital Energy D90 Plus Line Distance Protection System Communications guide D90 Plus firmware revision:.9x GE publication code: 60-9070-F (GEK-3469) GE Digital Energy 650 Markland Street

More information

2.2 THE MARIE Instruction Set Architecture

2.2 THE MARIE Instruction Set Architecture 2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform

More information

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine Computer Organization & Assembly Language Programming CSE 2312 Lecture 15 Addressing and Subroutine 1 Sections in 8088 Code TEXT section, for the processor instructions. DATA section for the initialization

More information

Final Exam 2, CS154. April 25, 2010

Final Exam 2, CS154. April 25, 2010 inal Exam 2, CS154 April 25, 2010 Exam rules. he exam is open book and open notes you can use any printed or handwritten material. However, no electronic devices are allowed. Anything with an on-off switch

More information

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */ Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,

More information

Dr. D.M. Akbar Hussain

Dr. D.M. Akbar Hussain 1 2 Compiler Construction F6S Lecture - 2 1 3 4 Compiler Construction F6S Lecture - 2 2 5 #include.. #include main() { char in; in = getch ( ); if ( isalpha (in) ) in = getch ( ); else error (); while

More information

COS 126 Written Exam 2 Spring 18

COS 126 Written Exam 2 Spring 18 COS 126 Written Exam 2 Spring 18 Instructions. This exam has 7 questions, worth 10 points each. You have 50 minutes. Resources. You may reference your optional two-sided 8.5-by-11 handwritten "cheat sheet"

More information