C++ program that processes unique markup language similar to HTML
I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a corresponding name and value.
For example:
<tag-name attribute1-name = "Value" attribute2-name = "Value2" ... >
A closing tag follows this format:
</tag-name>
The tags may also be nested. For example:
<tag1 value = "HelloWorld">
<tag2 name = "Name1">
</tag2>
</tag1>
Attributes are referenced as:
tag1~value
tag1.tag2~name
The source code of the markup language is given in n
lines of input, the number of attribute references or queries is q
.
I am seeking any improvements to my code and any bad practices I may be using.
#include <vector>
#include <iostream>
using namespace std;
typedef vector < string > VS;
typedef vector < VS > VVS;
//Takes numberOfLines of input and splits the lines into strings
VS Split(int numberOfLines) {
VS myVec;
string x;
for (int i = 0; i < numberOfLines; i++) {
getline(cin, x);
string::size_type start = 0;
string::size_type end = 0;
while ((end = x.find(" ", start)) != string::npos) {
myVec.push_back(x.substr(start, end - start));
start = end + 1;
}
myVec.push_back(x.substr(start));
}
return myVec;
}
//removes unnecessary characters in this case they are: " ,
// > (if it is the final element of the tag), and "
string Remove(string s) {
string c = s;
c.erase(c.begin());
auto x = c.end() - 1;
if ( * x == '>') {
c.erase(x);
x = c.end() - 1;
}
c.erase(x);
return c;
}
int main() {
VS HRML, attributes, values, t, validTags;
VVS Tags, ValidAttributes, ValidValues;
int n, q;
cin >> n >> q;
HRML = Split(n);
//does the heavy lifting
for (int i = 0; i < HRML.size(); i++) {
string x = HRML[i];
//checks if x contains the beginning of the starting tag
if (x[0] == '<' && x[1] != '/') {
//checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
auto c = x.end() - 1;
if ( * c == '>') {
x.erase(c);
}
x.erase(x.begin());
t.push_back(x);
Tags.push_back(t);
}
// checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
//checks if x contains the ending tag
else if (x[1] == '/') {
x.erase(x.begin());
x.erase(x.begin());
x.erase(x.end() - 1);
for (int i = 0; i < t.size(); i++) {
if (x == t[i]) {
t.erase(t.begin() + i);
}
}
}
//checks to see if an attribute has been assigned a value
else if (x == "=") {
attributes.push_back(HRML[i - 1]);
values.push_back(Remove(HRML[i + 1]));
}
}
string x = "";
//makes valid(user-usable) tags from all the tags
// passed into vector<string> Tags
for (int i = 0; i < Tags.size(); i++) {
for (int j = 0; j < Tags[i].size(); j++) {
if (Tags[i].size() > 1) {
string begin = Tags[i][j] + '.';
x += begin;
if (j == (Tags[i].size() - 1)) {
x.erase(x.end() - 1);
validTags.push_back(x + '~');
x = "";
}
} else {
validTags.push_back(Tags[i][0] + '~');
}
}
}
//iterates through each query given by the user and checks if it is valid
for (int i = 0; i < q + 1; i++) {
string output = "";
if (i == 0) {
string x;
getline(cin, x);
} else {
string x;
getline(cin, x);
int c = 0;
for (int j = 0; j < validTags.size(); j++) {
for (int p = 0; p < ValidAttributes[c].size(); p++) {
if (x == validTags[j] + ValidAttributes[c][p]) {
output = ValidValues[c][p];
/*if a valid attribute reference has been
found then there is no need to check the rest
of validAttribute[c] */
goto endOfLoop;
} else {
output = "Not Found!";
}
}
if (c < (ValidAttributes.size() - 1)) {
c++;
}
}
endOfLoop:
cout << output << endl;
}
}
return 0;
}
c++ parsing reinventing-the-wheel
New contributor
add a comment |
I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a corresponding name and value.
For example:
<tag-name attribute1-name = "Value" attribute2-name = "Value2" ... >
A closing tag follows this format:
</tag-name>
The tags may also be nested. For example:
<tag1 value = "HelloWorld">
<tag2 name = "Name1">
</tag2>
</tag1>
Attributes are referenced as:
tag1~value
tag1.tag2~name
The source code of the markup language is given in n
lines of input, the number of attribute references or queries is q
.
I am seeking any improvements to my code and any bad practices I may be using.
#include <vector>
#include <iostream>
using namespace std;
typedef vector < string > VS;
typedef vector < VS > VVS;
//Takes numberOfLines of input and splits the lines into strings
VS Split(int numberOfLines) {
VS myVec;
string x;
for (int i = 0; i < numberOfLines; i++) {
getline(cin, x);
string::size_type start = 0;
string::size_type end = 0;
while ((end = x.find(" ", start)) != string::npos) {
myVec.push_back(x.substr(start, end - start));
start = end + 1;
}
myVec.push_back(x.substr(start));
}
return myVec;
}
//removes unnecessary characters in this case they are: " ,
// > (if it is the final element of the tag), and "
string Remove(string s) {
string c = s;
c.erase(c.begin());
auto x = c.end() - 1;
if ( * x == '>') {
c.erase(x);
x = c.end() - 1;
}
c.erase(x);
return c;
}
int main() {
VS HRML, attributes, values, t, validTags;
VVS Tags, ValidAttributes, ValidValues;
int n, q;
cin >> n >> q;
HRML = Split(n);
//does the heavy lifting
for (int i = 0; i < HRML.size(); i++) {
string x = HRML[i];
//checks if x contains the beginning of the starting tag
if (x[0] == '<' && x[1] != '/') {
//checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
auto c = x.end() - 1;
if ( * c == '>') {
x.erase(c);
}
x.erase(x.begin());
t.push_back(x);
Tags.push_back(t);
}
// checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
//checks if x contains the ending tag
else if (x[1] == '/') {
x.erase(x.begin());
x.erase(x.begin());
x.erase(x.end() - 1);
for (int i = 0; i < t.size(); i++) {
if (x == t[i]) {
t.erase(t.begin() + i);
}
}
}
//checks to see if an attribute has been assigned a value
else if (x == "=") {
attributes.push_back(HRML[i - 1]);
values.push_back(Remove(HRML[i + 1]));
}
}
string x = "";
//makes valid(user-usable) tags from all the tags
// passed into vector<string> Tags
for (int i = 0; i < Tags.size(); i++) {
for (int j = 0; j < Tags[i].size(); j++) {
if (Tags[i].size() > 1) {
string begin = Tags[i][j] + '.';
x += begin;
if (j == (Tags[i].size() - 1)) {
x.erase(x.end() - 1);
validTags.push_back(x + '~');
x = "";
}
} else {
validTags.push_back(Tags[i][0] + '~');
}
}
}
//iterates through each query given by the user and checks if it is valid
for (int i = 0; i < q + 1; i++) {
string output = "";
if (i == 0) {
string x;
getline(cin, x);
} else {
string x;
getline(cin, x);
int c = 0;
for (int j = 0; j < validTags.size(); j++) {
for (int p = 0; p < ValidAttributes[c].size(); p++) {
if (x == validTags[j] + ValidAttributes[c][p]) {
output = ValidValues[c][p];
/*if a valid attribute reference has been
found then there is no need to check the rest
of validAttribute[c] */
goto endOfLoop;
} else {
output = "Not Found!";
}
}
if (c < (ValidAttributes.size() - 1)) {
c++;
}
}
endOfLoop:
cout << output << endl;
}
}
return 0;
}
c++ parsing reinventing-the-wheel
New contributor
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
3
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
You have agoto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.
– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago
add a comment |
I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a corresponding name and value.
For example:
<tag-name attribute1-name = "Value" attribute2-name = "Value2" ... >
A closing tag follows this format:
</tag-name>
The tags may also be nested. For example:
<tag1 value = "HelloWorld">
<tag2 name = "Name1">
</tag2>
</tag1>
Attributes are referenced as:
tag1~value
tag1.tag2~name
The source code of the markup language is given in n
lines of input, the number of attribute references or queries is q
.
I am seeking any improvements to my code and any bad practices I may be using.
#include <vector>
#include <iostream>
using namespace std;
typedef vector < string > VS;
typedef vector < VS > VVS;
//Takes numberOfLines of input and splits the lines into strings
VS Split(int numberOfLines) {
VS myVec;
string x;
for (int i = 0; i < numberOfLines; i++) {
getline(cin, x);
string::size_type start = 0;
string::size_type end = 0;
while ((end = x.find(" ", start)) != string::npos) {
myVec.push_back(x.substr(start, end - start));
start = end + 1;
}
myVec.push_back(x.substr(start));
}
return myVec;
}
//removes unnecessary characters in this case they are: " ,
// > (if it is the final element of the tag), and "
string Remove(string s) {
string c = s;
c.erase(c.begin());
auto x = c.end() - 1;
if ( * x == '>') {
c.erase(x);
x = c.end() - 1;
}
c.erase(x);
return c;
}
int main() {
VS HRML, attributes, values, t, validTags;
VVS Tags, ValidAttributes, ValidValues;
int n, q;
cin >> n >> q;
HRML = Split(n);
//does the heavy lifting
for (int i = 0; i < HRML.size(); i++) {
string x = HRML[i];
//checks if x contains the beginning of the starting tag
if (x[0] == '<' && x[1] != '/') {
//checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
auto c = x.end() - 1;
if ( * c == '>') {
x.erase(c);
}
x.erase(x.begin());
t.push_back(x);
Tags.push_back(t);
}
// checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
//checks if x contains the ending tag
else if (x[1] == '/') {
x.erase(x.begin());
x.erase(x.begin());
x.erase(x.end() - 1);
for (int i = 0; i < t.size(); i++) {
if (x == t[i]) {
t.erase(t.begin() + i);
}
}
}
//checks to see if an attribute has been assigned a value
else if (x == "=") {
attributes.push_back(HRML[i - 1]);
values.push_back(Remove(HRML[i + 1]));
}
}
string x = "";
//makes valid(user-usable) tags from all the tags
// passed into vector<string> Tags
for (int i = 0; i < Tags.size(); i++) {
for (int j = 0; j < Tags[i].size(); j++) {
if (Tags[i].size() > 1) {
string begin = Tags[i][j] + '.';
x += begin;
if (j == (Tags[i].size() - 1)) {
x.erase(x.end() - 1);
validTags.push_back(x + '~');
x = "";
}
} else {
validTags.push_back(Tags[i][0] + '~');
}
}
}
//iterates through each query given by the user and checks if it is valid
for (int i = 0; i < q + 1; i++) {
string output = "";
if (i == 0) {
string x;
getline(cin, x);
} else {
string x;
getline(cin, x);
int c = 0;
for (int j = 0; j < validTags.size(); j++) {
for (int p = 0; p < ValidAttributes[c].size(); p++) {
if (x == validTags[j] + ValidAttributes[c][p]) {
output = ValidValues[c][p];
/*if a valid attribute reference has been
found then there is no need to check the rest
of validAttribute[c] */
goto endOfLoop;
} else {
output = "Not Found!";
}
}
if (c < (ValidAttributes.size() - 1)) {
c++;
}
}
endOfLoop:
cout << output << endl;
}
}
return 0;
}
c++ parsing reinventing-the-wheel
New contributor
I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a corresponding name and value.
For example:
<tag-name attribute1-name = "Value" attribute2-name = "Value2" ... >
A closing tag follows this format:
</tag-name>
The tags may also be nested. For example:
<tag1 value = "HelloWorld">
<tag2 name = "Name1">
</tag2>
</tag1>
Attributes are referenced as:
tag1~value
tag1.tag2~name
The source code of the markup language is given in n
lines of input, the number of attribute references or queries is q
.
I am seeking any improvements to my code and any bad practices I may be using.
#include <vector>
#include <iostream>
using namespace std;
typedef vector < string > VS;
typedef vector < VS > VVS;
//Takes numberOfLines of input and splits the lines into strings
VS Split(int numberOfLines) {
VS myVec;
string x;
for (int i = 0; i < numberOfLines; i++) {
getline(cin, x);
string::size_type start = 0;
string::size_type end = 0;
while ((end = x.find(" ", start)) != string::npos) {
myVec.push_back(x.substr(start, end - start));
start = end + 1;
}
myVec.push_back(x.substr(start));
}
return myVec;
}
//removes unnecessary characters in this case they are: " ,
// > (if it is the final element of the tag), and "
string Remove(string s) {
string c = s;
c.erase(c.begin());
auto x = c.end() - 1;
if ( * x == '>') {
c.erase(x);
x = c.end() - 1;
}
c.erase(x);
return c;
}
int main() {
VS HRML, attributes, values, t, validTags;
VVS Tags, ValidAttributes, ValidValues;
int n, q;
cin >> n >> q;
HRML = Split(n);
//does the heavy lifting
for (int i = 0; i < HRML.size(); i++) {
string x = HRML[i];
//checks if x contains the beginning of the starting tag
if (x[0] == '<' && x[1] != '/') {
//checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
auto c = x.end() - 1;
if ( * c == '>') {
x.erase(c);
}
x.erase(x.begin());
t.push_back(x);
Tags.push_back(t);
}
// checks if x contains the end of the starting tag
if (x[x.size() - 1] == '>' && x[1] != '/') {
ValidAttributes.push_back(attributes);
attributes.clear();
ValidValues.push_back(values);
values.clear();
}
//checks if x contains the ending tag
else if (x[1] == '/') {
x.erase(x.begin());
x.erase(x.begin());
x.erase(x.end() - 1);
for (int i = 0; i < t.size(); i++) {
if (x == t[i]) {
t.erase(t.begin() + i);
}
}
}
//checks to see if an attribute has been assigned a value
else if (x == "=") {
attributes.push_back(HRML[i - 1]);
values.push_back(Remove(HRML[i + 1]));
}
}
string x = "";
//makes valid(user-usable) tags from all the tags
// passed into vector<string> Tags
for (int i = 0; i < Tags.size(); i++) {
for (int j = 0; j < Tags[i].size(); j++) {
if (Tags[i].size() > 1) {
string begin = Tags[i][j] + '.';
x += begin;
if (j == (Tags[i].size() - 1)) {
x.erase(x.end() - 1);
validTags.push_back(x + '~');
x = "";
}
} else {
validTags.push_back(Tags[i][0] + '~');
}
}
}
//iterates through each query given by the user and checks if it is valid
for (int i = 0; i < q + 1; i++) {
string output = "";
if (i == 0) {
string x;
getline(cin, x);
} else {
string x;
getline(cin, x);
int c = 0;
for (int j = 0; j < validTags.size(); j++) {
for (int p = 0; p < ValidAttributes[c].size(); p++) {
if (x == validTags[j] + ValidAttributes[c][p]) {
output = ValidValues[c][p];
/*if a valid attribute reference has been
found then there is no need to check the rest
of validAttribute[c] */
goto endOfLoop;
} else {
output = "Not Found!";
}
}
if (c < (ValidAttributes.size() - 1)) {
c++;
}
}
endOfLoop:
cout << output << endl;
}
}
return 0;
}
c++ parsing reinventing-the-wheel
c++ parsing reinventing-the-wheel
New contributor
New contributor
edited 5 hours ago
Uzemljenje
New contributor
asked yesterday
UzemljenjeUzemljenje
112
112
New contributor
New contributor
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
3
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
You have agoto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.
– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago
add a comment |
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
3
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
You have agoto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.
– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
3
3
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
You have a
goto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.– Martin York
6 hours ago
You have a
goto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Uzemljenje is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210995%2fc-program-that-processes-unique-markup-language-similar-to-html%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Uzemljenje is a new contributor. Be nice, and check out our Code of Conduct.
Uzemljenje is a new contributor. Be nice, and check out our Code of Conduct.
Uzemljenje is a new contributor. Be nice, and check out our Code of Conduct.
Uzemljenje is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210995%2fc-program-that-processes-unique-markup-language-similar-to-html%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could use Yacc to generate the parser, rather than use custom error-prone parsing.
– esote
yesterday
3
This was just a task I decided to do for fun.
– Uzemljenje
yesterday
You have a
goto
in your code. Most coding standards consider this bad just by itself. I would consider it bad only if you can't justify it. But there is no comment explaining why you need a goto.– Martin York
6 hours ago
Your indentation is horrible and makes the code nearly unreadable. I'll come back and review it if you fix the indentation. But otherwise I'll just ignore.
– Martin York
6 hours ago
@MartinYork I have re-formatted the code. If it is sill unreadable, please let me know.
– Uzemljenje
4 hours ago