-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr-forth.cpp
53 lines (39 loc) · 1.13 KB
/
r-forth.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include "token.hpp"
using namespace std;
std::queue<std::string> make_into_queue(std::string line){
std::istringstream iss(line);
std::string token;
std::queue<std::string> tokens;
while (iss >> token) {
tokens.push(token);
}
return tokens;
}
int main(){
//declaration of an int stack
//std::stack<int> myStack;
//string stack
//std::stack<std::string> stringList;
cout << "Type 'bye' to exit\n";
std::string line; // Declaration of 'line' as a std::string
std::stack<std::string> myStack, stringList;
std::stack<int> intList;
while (std::getline(std::cin, line)) {
if (!line.empty() && line.back() == '\n') {
line.pop_back();
}
if (line == "bye") {
break;
}
std::queue<std::string> queue1 = make_into_queue(line);
std::stack<std::string> stack1 = queue_to_stack(queue1);
token_separator(stack1, queue1);
//separate_token(myStack, line, stringList, intList);
//print_forth(myStack);
}
return 0;
}