-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
LD=$(CXX) | ||
DEBUG=-ggdb | ||
CXXFLAGS=-O3 -Wall $(DEBUG) $(INCPATHS) -std=c++11 | ||
LDFLAGS=-O3 $(DEBUG) $(LIBPATHS) -L. -lreadline -lhistory | ||
|
||
LIBSOURCES=Core.cpp Environment.cpp Reader.cpp ReadLine.cpp String.cpp \ | ||
Types.cpp Validation.cpp | ||
LIBOBJS=$(LIBSOURCES:%.cpp=%.o) | ||
|
||
MAINS=$(wildcard step*.cc) | ||
TARGETS=$(MAINS:%.cc=%) | ||
|
||
.PHONY: all clean | ||
|
||
.SUFFIXES: .cc .o | ||
|
||
all: $(TARGETS) | ||
|
||
dist: mal | ||
|
||
mal: stepA_mal | ||
cp $< $@ | ||
|
||
.deps: *.cc *.h | ||
$(CXX) $(CXXFLAGS) -MM *.cc > .deps | ||
|
||
$(TARGETS): %: %.o #libmal.a | ||
$(LD) $^ -o $@ $(LDFLAGS) | ||
|
||
libmal.a: $(LIBOBJS) | ||
$(AR) rcs $@ $^ | ||
|
||
.cc.o: | ||
$(CXX) $(CXXFLAGS) -c $< -o $@ | ||
|
||
clean: | ||
rm -rf *.o $(TARGETS) libmal.a .deps mal | ||
|
||
-include .deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
exec $(dirname $0)/${STEP:-stepA_mal} "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
std::string read(std::string input) | ||
{ | ||
return input; | ||
} | ||
|
||
std::string eval(std::string input) | ||
{ | ||
return input; | ||
} | ||
|
||
std::string print(std::string input) | ||
{ | ||
return input; | ||
} | ||
|
||
std::string rep(std::string input) | ||
{ | ||
auto read_result = read(input); | ||
auto eval_result = eval(read_result); | ||
auto print_result = print(eval_result); | ||
return print_result; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
std::string input; | ||
|
||
while (!std::cin.eof()) | ||
{ | ||
std::cout << "user> "; | ||
std::getline(std::cin, input); | ||
auto rep_result = rep(input); | ||
std::cout << rep_result << std::endl; | ||
} | ||
|
||
return 0; | ||
} |