Question: help with prog3_2.lua pls prog3_2.lua In Lua, implement the Infix to Postfix function that went over in class. The function InfixToPostfix(str) takes a single argument

help with prog3_2.lua pls

prog3_2.lua In Lua, implement the Infix to Postfix function that went over in class. The function

InfixToPostfix(str) takes a single argument (it will be an input string). To

kenize that input string

by space (split by space) and then apply the infix to postfix algorithm to return a postfix string.

prog3_3.cpp will be written in C/C++. It will be called prog3_3.cpp and can/should be an

extension of prog3_1.cpp The program will create a lua environment, load/run the file specified

by the command line argument. It will then take in a line of input from the stdin, call the

InfixToPostfix() function in lua (use the dostring), retrieve the resulting postfix string from the

lua stack (use the checkstring function) and then print the resultant postfix string.

this program is called prog3_3.cpp which complies but I am having trouble how to write a InfixToPostfix() function in lua help pls!

#include #include #include #include #include #include #include #include using namespace std; int main(int argc, char * argv[]){ string buffer, infix; const char *finalstring; lua_State *L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L,argv[1]); getline(cin,buffer); lua_getglobal(L,"InfixtoPostfix"); lua_pushstring(L,buffer.c_str()); finalstring = lua_tostring(L, -1); cout << finalstring << endl; lua_close(L); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!