diff --git a/src/main/kotlin/function/FunctionNames.java b/src/main/kotlin/function/FunctionNames.java deleted file mode 100644 index 5e8005b..0000000 --- a/src/main/kotlin/function/FunctionNames.java +++ /dev/null @@ -1,13 +0,0 @@ -package function; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface FunctionNames { - - String[] value(); -} diff --git a/src/main/kotlin/function/FunctionNames.kt b/src/main/kotlin/function/FunctionNames.kt new file mode 100644 index 0000000..cd6394f --- /dev/null +++ b/src/main/kotlin/function/FunctionNames.kt @@ -0,0 +1,10 @@ +package function + +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy.RUNTIME +import kotlin.annotation.AnnotationTarget.CLASS +import kotlin.annotation.AnnotationTarget.FILE + +@Retention(RUNTIME) +@Target(CLASS, FILE) +annotation class FunctionNames(vararg val value: String) diff --git a/src/main/kotlin/function/LispFunction.java b/src/main/kotlin/function/LispFunction.java deleted file mode 100644 index bd2c48b..0000000 --- a/src/main/kotlin/function/LispFunction.java +++ /dev/null @@ -1,17 +0,0 @@ -package function; - -import sexpression.Cons; -import sexpression.SExpression; - -public abstract class LispFunction { - - public abstract SExpression call(Cons argumentList); - - public boolean isArgumentListEvaluated() { - return true; - } - - public boolean isMacro() { - return false; - } -} diff --git a/src/main/kotlin/function/LispFunction.kt b/src/main/kotlin/function/LispFunction.kt new file mode 100644 index 0000000..159bdc3 --- /dev/null +++ b/src/main/kotlin/function/LispFunction.kt @@ -0,0 +1,15 @@ +package function + +import sexpression.Cons +import sexpression.SExpression + +abstract class LispFunction { + + open val isArgumentListEvaluated: Boolean + get() = true + + open val isMacro: Boolean + get() = false + + abstract fun call(argumentList: Cons): SExpression +} diff --git a/src/main/kotlin/function/LispSpecialFunction.java b/src/main/kotlin/function/LispSpecialFunction.java deleted file mode 100644 index 3b8953d..0000000 --- a/src/main/kotlin/function/LispSpecialFunction.java +++ /dev/null @@ -1,9 +0,0 @@ -package function; - -public abstract class LispSpecialFunction extends LispFunction { - - @Override - public boolean isArgumentListEvaluated() { - return false; - } -} diff --git a/src/main/kotlin/function/LispSpecialFunction.kt b/src/main/kotlin/function/LispSpecialFunction.kt new file mode 100644 index 0000000..ad55f88 --- /dev/null +++ b/src/main/kotlin/function/LispSpecialFunction.kt @@ -0,0 +1,7 @@ +package function + +abstract class LispSpecialFunction : LispFunction() { + + override val isArgumentListEvaluated: Boolean + get() = false +} diff --git a/src/main/kotlin/function/UserDefinedMacro.java b/src/main/kotlin/function/UserDefinedMacro.java deleted file mode 100644 index 02f0baf..0000000 --- a/src/main/kotlin/function/UserDefinedMacro.java +++ /dev/null @@ -1,15 +0,0 @@ -package function; - -import sexpression.Cons; - -public class UserDefinedMacro extends UserDefinedSpecialFunction { - - public UserDefinedMacro(String name, Cons lambdaList, Cons body) { - super(name, lambdaList, body); - } - - @Override - public boolean isMacro() { - return true; - } -} diff --git a/src/main/kotlin/function/UserDefinedMacro.kt b/src/main/kotlin/function/UserDefinedMacro.kt new file mode 100644 index 0000000..33671bb --- /dev/null +++ b/src/main/kotlin/function/UserDefinedMacro.kt @@ -0,0 +1,10 @@ +package function + +import sexpression.Cons + +class UserDefinedMacro(name: String, lambdaList: Cons, body: Cons) + : UserDefinedSpecialFunction(name, lambdaList, body) { + + override val isMacro: Boolean + get() = true +} diff --git a/src/main/kotlin/function/UserDefinedSpecialFunction.java b/src/main/kotlin/function/UserDefinedSpecialFunction.java deleted file mode 100644 index 848c398..0000000 --- a/src/main/kotlin/function/UserDefinedSpecialFunction.java +++ /dev/null @@ -1,15 +0,0 @@ -package function; - -import sexpression.Cons; - -public class UserDefinedSpecialFunction extends UserDefinedFunction { - - public UserDefinedSpecialFunction(String name, Cons lambdaList, Cons body) { - super(name, lambdaList, body); - } - - @Override - public boolean isArgumentListEvaluated() { - return false; - } -} diff --git a/src/main/kotlin/function/UserDefinedSpecialFunction.kt b/src/main/kotlin/function/UserDefinedSpecialFunction.kt new file mode 100644 index 0000000..12d82cc --- /dev/null +++ b/src/main/kotlin/function/UserDefinedSpecialFunction.kt @@ -0,0 +1,10 @@ +package function + +import sexpression.Cons + +open class UserDefinedSpecialFunction(name: String, lambdaList: Cons, body: Cons) + : UserDefinedFunction(name, lambdaList, body) { + + override val isArgumentListEvaluated: Boolean + get() = false +} diff --git a/src/main/kotlin/table/FunctionTable.kt b/src/main/kotlin/table/FunctionTable.kt index ac58649..10b970d 100644 --- a/src/main/kotlin/table/FunctionTable.kt +++ b/src/main/kotlin/table/FunctionTable.kt @@ -124,7 +124,7 @@ object FunctionTable { addAllFunctionNamesToTable(function, functionNames.value) } - private fun addAllFunctionNamesToTable(function: Class, names: Array) { + private fun addAllFunctionNamesToTable(function: Class, names: Array) { for (name in names) table[name] = createInstance(function, name) }