Restructure project to make room for clox

This commit is contained in:
Tom Willemse 2021-07-08 00:14:31 -07:00
parent 62bd0f83dc
commit 68a2ebd34f
Signed by: ryuslash
GPG key ID: 7D5C407B435025C1
31 changed files with 27 additions and 7 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
jlox.sum
jlox.log

4
Jenkinsfile vendored
View file

@ -10,10 +10,10 @@ pipeline {
steps { steps {
cmakeBuild installation: 'InSearchPath', cmakeBuild installation: 'InSearchPath',
buildDir: 'build', buildDir: 'build',
sourceDir: 'src', sourceDir: 'jlox',
steps: [[args: 'all']] steps: [[args: 'all']]
archiveArtifacts artifacts: 'build/com/craftinginterpreters/lox/Lox.jar', archiveArtifacts artifacts: 'jlox/_build/com/craftinginterpreters/lox/Lox.jar',
fingerprint: false, fingerprint: false,
onlyIfSuccessful: true onlyIfSuccessful: true
} }

3
jlox
View file

@ -1,3 +0,0 @@
#!/usr/bin/env sh
/usr/bin/java -jar src/_build/com/craftinginterpreters/lox/Lox.jar "$@"

View file

View file

@ -5,4 +5,4 @@ include(UseJava)
project(Lox NONE) project(Lox NONE)
add_subdirectory(com/craftinginterpreters) add_subdirectory(src/com/craftinginterpreters)

3
jlox/jlox Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/_build/src/com/craftinginterpreters/lox/Lox.jar" "$@"

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.lineSplit=80

9
src/fib.lox Normal file
View file

@ -0,0 +1,9 @@
fun fib(n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
var before = clock();
print fib(40);
var after = clock();
print after - before;

7
src/test.lox Normal file
View file

@ -0,0 +1,7 @@
class Bacon {
eat() {
print "Crunch crunch crunch!";
}
}
Bacon().eat();

View file

@ -1,5 +1,5 @@
set test_name "Printing" set test_name "Printing"
set command_line "./jlox" set command_line "jlox/jlox"
spawn $command_line spawn $command_line
send "print \"Hello, world!\";\n" send "print \"Hello, world!\";\n"