CS320 Assignment #3
Purpose
This assignment is designed to familiarize you with LUA programming, parsers.
Requirements
This assignment consists of one major requirements.
1) Developing solutions to the problems below.
2) Your assignments will be checked, submitted and graded electronically.
Problem
1) prog3_1.cpp will be implemented in C/C++. Program 1 will take a single command line argument
(other than the name of the program). The command line argument will be the name of a lua file. Your
program should then execute the Lua file in a lua environment you create in your C/C++ program. You
should expect the lua-5.3.4 source folder is in the current directory. (Please do not commit the lua-5.3.4
folder to your repository).
Program 1 will be compiled like so:
g++ prog3_1.cpp –o prog3_1 –I lua-5.3.4/src –L lua-5.3.4/src –l lua –l
m –l dl
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). Tokenize 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.