Skip to content

sourcewarehouse/translator-6

 
 

Repository files navigation

{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww25400\viewh13100\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc
\cf0 \ul \ulc0  Readme\ulnone \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\i \cf0 \ul Initial Configuration for Patches
\i0 \ulnone  ( 
\b  run these commands once to forever patch xtc.lang's JavaExternalAnalyzer to run with our program
\b0 ) \
	\
	1.) Put all java files in xtc/src/oop\
	 \
	\
	
\b The Following Commands are Only run Once 
\b0 \
		2.) cd src/oop\
		3.) make patchxtc \
		4.) cd ../..\
		5.) make clean \
		6.) make \
		7.) cd src/oop \
\

\i \ul Running the Translator
\i0 \ulnone  (
\b Always done in src/oop directory / Also with the assumption that you done a source setup.sh in xtc's root directory
\b0 ) \
\
	8.) java oop.Translator -translate Tests/Test#.java ( 
\b ex. java oop.Translator -translate Tests/Test1.java
\b0  )\
\

\i \ul Compiling the Generated C++ Code 
\i0 \ulnone (
\b Always done in src/oop/cplusplusfiles
\b0 )\
\
	9.) cd cplusplusfiles \
          10.) g++ Method_Bod.cc main.cc java_lang.cc \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc

\fs40 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\i\fs24 \cf0 \ul Running the C++ Code 
\i0 \ulnone (
\b Always done in src/oop/cplusplusfiles
\b0 )\
	\
	11.) ./a.out \
\
----------------------------------------------------------x---------------------------------------------------------------------------\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc
\cf0 \ul Note about Test Inputs\ulnone  \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\cf0 1.) 
\i\b\fs26 \ul Homemade Test Cases are prefixed with either 100 or 00
\i0\fs24  
\b0 \ulnone such as 
\b Test0082.java
\b0  or 
\b Test1004.java
\b0 . Homemade Test cases have at the top a
\b  comment
\b0  as such \
		\
		/
\b * Test Input Description **/ 
\b0 \
		// What is This Test Input trying to Test ? More Specifically what features like Polymorphism, Method Chaining, or Virtual 		  Method Dispatch \'85  are being emphasized 	\
		
\b /*Test Input Description **/ 
\b0 \
\
2.) Most of these Test inputs are either original ones that Professor  Wies gave us or tweaks of the ones that we given to us. However it is 
\b \ul VERY IMPORTANT THAT YOU
\b0 \ulnone  
\b read the Test Input Descriptions for the Homemade Test cases & run our project on \ul ALL THE TEST CASES THAT WE HAVE GIVEN YOU IN TESTS FOLDER\ulnone  you will see that we have the following features covered 
\b0 \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc
\cf0 Features Covered \
1.) Virtual Method Dispatch \
2.) Everything about Single Dimensional Arrays / Calling Methods on the objects stored in the Arrays \
3.) Symbol Table Logic finding local variables / fields\
4.) Method Chaining \
5.) Command Line Arguments \
6.) Separate Compilation( Header.h Method_Bod.cc main.cc) \
7.) Initializer Lists versus assignment to minimize Compilation times \
8.) For Statements, While Statements, If Statements \
9.) Constructors invoking Super Constructors \
10.) Overloading of Method Calls \
11.) Static Variables \
12) Calls to super in a sub class \
\
13.) Polymorphic Declarations/ Assignments \
14.) Correct Usage of Smart Pointers \
\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc

\b \cf0 \ul About the Tweaks \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc

\b0 \cf0 \ulnone The way I handled Overloading was to append the type of each argument to the method each one delimited by an "_". Therefore When looking at the expression statement when a method is being called in the main method declaration of the slightly modified Java AST  I would look at the node Arguments and for each one append the string like if i had in the Argument Node a  NewClassExpression within in the QualifiedIdentifier id append that child . If it was a Cast Expression again i would find the  type and append it. However the problem with passing  just a primary identifier was that Id had no way to retrieve the reference type in Expression Statement's node Arguments. So by changing the primary Identifier to a new Class Expression or adding a redundant cast I was able to append to the method name the type of that arguement. Nonetheless run the test inputs given\
\
}

About

OOP Translator java to C++ ( please look at http://cs.nyu.edu/rgrimm/xtc/step-by-step.html for installing xtc framework)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 92.6%
  • C++ 6.7%
  • Makefile 0.7%