Skip to content

Commit 2ecdc0c

Browse files
committed
enhance: improve setup process in Makefile for interpreter-tester
1 parent 7356d9f commit 2ecdc0c

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Makefile

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,29 @@ test_functions_w_jlox: build
156156
test_all: test_scanning_w_jlox test_parsing_w_jlox test_evaluation_w_jlox test_statements_w_jlox test_control_flow_w_jlox
157157

158158
setup:
159-
@echo "Setup in interpreter-tester"
159+
echo "Setting up interpreter-tester prerequisites..."
160+
161+
# Clone repositories
162+
git clone https://github.com/munificent/craftinginterpreters.git || true
163+
164+
# Get Dart dependencies
165+
cd craftinginterpreters && make get
166+
167+
# Update Scanner implementation
168+
sed -i 's/Lox\.error(line, "Unexpected character\.");/Lox\.error(line, "Unexpected character: " + c);/g' craftinginterpreters/java/com/craftinginterpreters/lox/Scanner.java
169+
170+
# Compile jlox and copy test helpers
171+
cd craftinginterpreters && make java_chapters
172+
mkdir -p craftinginterpreters/build/gen/{chap04_scanning,chap06_parsing,chap07_evaluating,chap08_statements,chap09_control,chap10_functions,chap13_inheritance}
173+
cp -r interpreter-tester/internal/test_helpers/jlox04/* craftinginterpreters/build/gen/chap04_scanning || true
174+
cp -r interpreter-tester/internal/test_helpers/jlox06/* craftinginterpreters/build/gen/chap06_parsing || true
175+
cp -r interpreter-tester/internal/test_helpers/jlox07/* craftinginterpreters/build/gen/chap07_evaluating || true
176+
cp -r interpreter-tester/internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap08_statements || true
177+
cp -r interpreter-tester/internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap09_control || true
178+
cp -r interpreter-tester/internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap10_functions || true
179+
cp -r interpreter-tester/internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap13_inheritance || true
180+
181+
# Cleanup
182+
rm -rf interpreter-tester
183+
184+
echo "Setup complete!"

0 commit comments

Comments
 (0)