Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable intitialisation correction & Charecter Data type Initalisation & Print function Fixed #43

Closed
wants to merge 5 commits into from

Conversation

AviBomb
Copy link

@AviBomb AviBomb commented Dec 9, 2018

This bit of added code takes care of the incorrect initialization of a variable
Eg: initialise a= 10
initialise a =10
initialise a = 10
would only create "float a" in the C code but after adding this bit of code you will get the C code as "float a=10" it will complete the initialisation

Also Character Initialisation has also been taken care of in this code. It enables you to initialise character by typing initialise char b= 'c' in sudocode and generates the C code of " char b='c' ". It can also print the character datatype using print b which will generate the C code printf("%c\n",b);

The issue with the print command has also been fixed: Supposing we have a variable called temp in the code and we want to print the word "Temp" and then print the data inside temp now there is feature enabling us to do just that. Now if we enclose temp in “(doublequotes)” it will only print the data in temp and not the variable temp .eg print “temp” will display the text temp and not the data inside variable temp.If the data in temp need to be printed it can be done by print temp. Also yet another similar issue resolved is that when we have two variables a and b in the program and we write in the pseudo-code print a+b instead of writing a+b in the program it writes the string "a+b" which makes it compulsory for us to create a temporary variable increasing both time and space complexity of the code. Both these issues can be sorted easily. Now that has been taken care of by putting the expression in round brackets (). eg print (a+b) will generate now the c code of printf("%f\n",a+b);. Now sample test files sudocode4 and sudocode5 have been added to the testfile folder to validate all the above corrected issues.

@AviBomb AviBomb changed the title Variable intitialisation correction Variable intitialisation correction & Charecter Data type Initalisation & Print function Fixed Dec 10, 2018
Copy link
Contributor

@sumanthd17 sumanthd17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code doesn't solve the problem of multiple spacing between variables and values. Only works for the corner cases tested in sudocode4.txt. Please change your approach to solve the problem.

Char initialization works only when written in the tested format. (fails with multiple spaces)

@AviBomb
Copy link
Author

AviBomb commented Dec 18, 2018

Hey Thanks for the inputs have worked on it and sent in a new pr #65 with the updated features

@AviBomb
Copy link
Author

AviBomb commented Dec 18, 2018

@sumanthd17 have a look at the new pr and test if it works for all cases you had in mind and do share your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants