[silvano@rivoira ~]$ mjavaOOCodeGenerator Reading "mjava.flex" Constructing NFA : 419 states in NFA Converting NFA to DFA : .................................................................................................................................................................................. 184 states before minimization, 159 states in minimized DFA Old file "Scanner.java" saved as "Scanner.java~" Writing code to "Scanner.java" Warning : Terminal "ILLEGAL_CHARACTER" was declared but never used ------- CUP v0.11a beta 20060608 Parser Generation Summary ------- 0 errors and 1 warning 52 terminals, 123 non-terminals, and 245 productions declared, producing 457 unique parse states. 1 terminal declared but not used. 0 non-terminal declared but not used. 0 productions never reduced. 0 conflicts detected (0 expected). Code written to "mjavac.java", and "sym.java". ---------------------------------------------------- (v0.11a beta 20060608) Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. ... Creating Symbol-Table for "./source/Sample/SampleProgram.mjava" ... NEW METHOD: 9355 (DOMAIN: 5, RANGE: 5) PUT printf IN e0: {printf=(9355, null, true, null null)} - VARIABLES: [] PUT scanf IN e0: {printf=(9355, null, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] e0: {printf=(9355, null, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: String e1: (e0) {} - VARIABLES: [] NEW CLASS: 7String (NAME: String, SUPER: null, ENV: e1) PUT String IN e0: {printf=(9355, null, true, null null), String=(7String, 7String, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS EXIT: String PUT CONSTANT struct = "%struct.String = type { }" IN GLOBALS e0: {printf=(9355, null, true, null null), String=(7String, 7String, true, type { } null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: Int e2: (e0) {} - VARIABLES: [] NEW CLASS: 7Int (NAME: Int, SUPER: null, ENV: e2) PUT Int IN e0: {printf=(9355, null, true, null null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] PUT VARIABLE n IN e2: (e0) {n=(2, 7Int, false, i32 %n)} - VARIABLES: [n] PUT Int IN e2: (e0) {n=(2, 7Int, false, i32 %n), Int=null} - VARIABLES: [n] CONSTRUCTOR ENTRY: Int e3: (e2) {} - VARIABLES: [] PUT VARIABLE i IN e3: (e2) {i=(2, 7Int, false, i32 %i)} - VARIABLES: [i] REMOVED VARIABLE i FROM e3: (e2) {i=(2, 7Int, false, i32 %i)} - VARIABLES: [] NEW REFERENCE: 907Int (REFERRED: 7Int, WIDTH: 4) NEW CONSTRUCTOR: 922907Int (DOMAIN: 2, RANGE: 907Int) CHANGED Int IN e2: (e0) {n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] CONSTRUCTOR EXIT e2: (e0) {n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] PUT f IN e2: (e0) {f=null, n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] METHOD ENTRY: f e4: (e2) {} - VARIABLES: [] NEW METHOD: 9352 (DOMAIN: 5, RANGE: 2) CHANGED f IN e2: (e0) {f=(9352, 7Int, true, null null), n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] METHOD EXIT e2: (e0) {f=(9352, 7Int, true, null null), n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] PUT fact IN e2: (e0) {f=(9352, 7Int, true, null null), fact=null, n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] METHOD ENTRY: fact e5: (e2) {} - VARIABLES: [] PUT VARIABLE n IN e5: (e2) {n=(2, 7Int, false, i32 %n)} - VARIABLES: [n] REMOVED VARIABLE n FROM e5: (e2) {n=(2, 7Int, false, i32 %n)} - VARIABLES: [] NEW METHOD: 9322 (DOMAIN: 2, RANGE: 2) CHANGED fact IN e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] METHOD EXIT e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32 %n), Int=(922907Int, 7Int, true, null null)} - VARIABLES: [n] CLASS EXIT: Int PUT CONSTANT struct = "%struct.Int = type { i32 }" IN GLOBALS e0: {printf=(9355, null, true, null null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: Test e6: (e0) {} - VARIABLES: [] NEW CLASS: 7Test (NAME: Test, SUPER: null, ENV: e6) PUT Test IN e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, null null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] PUT main IN e6: (e0) {main=null} - VARIABLES: [] METHOD ENTRY: main e7: (e6) {} - VARIABLES: [] CHANGED main IN e6: (e0) {main=(9355, 7Test, true, null null)} - VARIABLES: [] PUT VARIABLE n IN e7: (e6) {n=(2, 7Test, false, i32 %n)} - VARIABLES: [n] PUT VARIABLE f IN e7: (e6) {f=(2, 7Test, false, i32 %f), n=(2, 7Test, false, i32 %n)} - VARIABLES: [n, f] PUT VARIABLE t IN e7: (e6) {f=(2, 7Test, false, i32 %f), t=(907Int, 7Test, false, %struct.Int* %t), n=(2, 7Test, false, i32 %n)} - VARIABLES: [n, f, t] BLOCK ENTRY e8: (e7) {} - VARIABLES: [] PUT CONSTANT @.str0 = "Enter an integer greater than 0 and less than 17: " IN GLOBALS PUT CONSTANT @.str1 = "%d" IN GLOBALS NEW REFERENCE: 902 (REFERRED: 2, WIDTH: 4) BLOCK EXIT e7: (e6) {f=(2, 7Test, false, i32 %f), t=(907Int, 7Test, false, %struct.Int* %t), n=(2, 7Test, false, i32 %n)} - VARIABLES: [n, f, t] PUT CONSTANT @.str2 = "factorial(%d)= %d " IN GLOBALS METHOD EXIT e6: (e0) {main=(9355, 7Test, true, null null)} - VARIABLES: [] CLASS EXIT: Test PUT CONSTANT struct = "%struct.Test = type { }" IN GLOBALS e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, type { } null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] Number of errors = 0. Number of warnings = 0. Types: 1 = i8 2 = i32 3 = double 4 = i1 5 = void 6 = error 7Int = Int 7String = String 7Test = Test 902 = *i32 907Int = *Int 922907Int = constructor: *Int(i32) 9322 = method: i32(i32) 9352 = method: i32(void) 9355 = method: void(void) ... Generating intermediate code for "./source/Sample/SampleProgram.mjava" ... e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, type { } null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: String e1: (e0) {} - VARIABLES: [] CURRENT CLASS: 7String (NAME: String, SUPER: null, ENV: e1) CLASS EXIT: String e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, type { } null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: Int e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32* getelementptr %struct.Int* %this, i32 0, i32 0), Int=(922907Int, 7Int, true, type { i32 } null)} - VARIABLES: [n] CURRENT CLASS: 7Int (NAME: Int, SUPER: null, ENV: e2) CONSTRUCTOR ENTRY: Int e3: (e2) {i=(2, 7Int, false, i32 %i)} - VARIABLES: [] CURRENT CONSTRUCTOR: Int, type: 922907Int (DOMAIN: 2, RANGE: 907Int) CONSTRUCTOR EXIT e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32* getelementptr %struct.Int* %this, i32 0, i32 0), Int=(922907Int, 7Int, true, type { i32 } null)} - VARIABLES: [n] METHOD ENTRY: f e4: (e2) {} - VARIABLES: [] CURRENT METHOD: f, type: 9352 (DOMAIN: 5, RANGE: 2) METHOD EXIT e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32* getelementptr %struct.Int* %this, i32 0, i32 0), Int=(922907Int, 7Int, true, type { i32 } null)} - VARIABLES: [n] METHOD ENTRY: fact e5: (e2) {n=(2, 7Int, false, i32 %n)} - VARIABLES: [] CURRENT METHOD: fact, type: 9322 (DOMAIN: 2, RANGE: 2) METHOD EXIT e2: (e0) {f=(9352, 7Int, true, null null), fact=(9322, 7Int, false, null null), n=(2, 7Int, false, i32* getelementptr %struct.Int* %this, i32 0, i32 0), Int=(922907Int, 7Int, true, type { i32 } null)} - VARIABLES: [n] CLASS EXIT: Int e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, type { } null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] CLASS ENTRY: Test e6: (e0) {main=(9355, 7Test, true, null null)} - VARIABLES: [] CURRENT CLASS: 7Test (NAME: Test, SUPER: null, ENV: e6) METHOD ENTRY: main e7: (e6) {f=(2, 7Test, false, i32 %f), t=(907Int, 7Test, false, %struct.Int* %t), n=(2, 7Test, false, i32 %n)} - VARIABLES: [n, f, t] CURRENT METHOD: main, type: 9355 (DOMAIN: 5, RANGE: 5) BLOCK ENTRY e8: (e7) {} - VARIABLES: [] NEW REFERENCE: 907String (REFERRED: 7String, WIDTH: 4) NEW PRODUCT: 91907String902 (LEFT: 907String, RIGHT: 902, WIDTH: 8) BLOCK EXIT e7: (e6) {f=(2, 7Test, false, i32* %f), t=(907Int, 7Test, false, %struct.Int** %t), n=(2, 7Test, false, i32* %n)} - VARIABLES: [n, f, t] NEW PRODUCT: 91907String2 (LEFT: 907String, RIGHT: 2, WIDTH: 8) NEW PRODUCT: 9191907String22 (LEFT: 91907String2, RIGHT: 2, WIDTH: 12) METHOD EXIT e6: (e0) {main=(9355, 7Test, true, null null)} - VARIABLES: [] CLASS EXIT: Test e0: {printf=(9355, null, true, null null), Test=(7Test, 7Test, true, type { } null), String=(7String, 7String, true, type { } null), Int=(7Int, 7Int, true, null null), scanf=(9355, null, true, null null)} - VARIABLES: [] Number of errors = 0. Number of warnings = 0. Types: 1 = i8 2 = i32 3 = double 4 = i1 5 = void 6 = error 7Int = Int 7String = String 7Test = Test 902 = *i32 907Int = *Int 907String = *String 91907String2 = *String, i32 91907String902 = *String, *i32 9191907String22 = *String, i32, i32 922907Int = constructor: *Int(i32) 9322 = method: i32(i32) 9352 = method: i32(void) 9355 = method: void(void) Code written to "./source/Sample/SampleProgram.mjava.ll". --------------------------------------- (mjavac) - assemble [ SampleProgram.mjava.ll ] into LLVM bitcode [ SampleProgram.mjava.bc ] - - compile [ SampleProgram.mjava.bc ] into Intel assembly language for x86 architecture [ SampleProgram.mjava.s ] - - run [ SampleProgram.mjava.bc ] - ............................................................................. Enter an integer greater than 0 and less than 17: 30 Enter an integer greater than 0 and less than 17: 12 factorial(12)= 479001600 ............................................................................. [silvano@rivoira ~]$