diff --git a/README.md b/README.md index 5237e0a..1b3069d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Ling: scripting lang for kotlin multiplatform +# Lyng: scripting lang for kotlin multiplatform in the form of multiplatform library. diff --git a/docs/List.md b/docs/List.md index abf6576..474ff3e 100644 --- a/docs/List.md +++ b/docs/List.md @@ -2,7 +2,7 @@ Mutable list of any objects. -It's class in Ling is `List`: +It's class in Lyng is `List`: [1,2,3]::class >>> List diff --git a/docs/OOP.md b/docs/OOP.md index ae6026e..da320f5 100644 --- a/docs/OOP.md +++ b/docs/OOP.md @@ -1,4 +1,4 @@ -# OO implementation in Ling +# OO implementation in Lyng Basic principles: @@ -15,7 +15,7 @@ Basic principles: ## Instances -Result of executing of any expression or statement in the Ling is the object that +Result of executing of any expression or statement in the Lyng is the object that inherits `Obj`, but is not `Obj`. For example it could be Int, void, null, real, string, bool, etc. This means whatever expression returns or the variable holds, is the first-class diff --git a/docs/Real.md b/docs/Real.md index 8010701..a76b47d 100644 --- a/docs/Real.md +++ b/docs/Real.md @@ -3,7 +3,7 @@ Class that supports double-precision math. Woks much like double in other languages. We honor no floats, so it is ' Real'. -It's class in Ling is `Real`: +It's class in Lyng is `Real`: (π/2)::class >>> Real diff --git a/docs/tutorial.md b/docs/tutorial.md index b72b37d..f749087 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,6 +1,6 @@ -# Ling tutorial +# Lyng tutorial -Ling is a very simple language, where we take only most important and popular features from +Lyng is a very simple language, where we take only most important and popular features from other scripts and languages. In particular, we adopt _principle of minimal confusion_[^1]. In other word, the code usually works as expected when you see it. So, nothing unusual. @@ -8,12 +8,12 @@ __Other documents to read__ maybe after this one: - [Advanced topics](advanced_topics.md) - [OOP notes](OOP.md) -- [math in Ling](math.md) +- [math in Lyng](math.md) - Some class references: [List](List.md), [Real](Real.md), [Range](Range.md) # Expressions -Everything is an expression in Ling. Even an empty block: +Everything is an expression in Lyng. Even an empty block: // empty block >>> void @@ -221,7 +221,7 @@ Notice how function definition return a value, instance of `Callable`. You can use both `fn` and `fun`. Note that function declaration _is an expression returning callable_. -There are default parameters in Ling: +There are default parameters in Lyng: fn check(amount, prefix = "answer: ") { prefix + if( amount > 100 ) @@ -273,7 +273,7 @@ If you need to create _unnamed_ function, use alternative syntax (TBD, like { -> # Lists (aka arrays) -Ling has built-in mutable array class `List` with simple literals: +Lyng has built-in mutable array class `List` with simple literals: [1, "two", 3.33].size >>> 3 @@ -546,7 +546,7 @@ We can skip the rest of the loop and restart it, as usual, with `continue` opera >>> 0 Notice that `total` remains 0 as the end of the outerLoop@ is not reachable: `continue` is always called and always make -Ling to skip it. +Lyng to skip it. ## else statement diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 6fdf536..422dc34 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -81,7 +81,7 @@ mavenPublishing { coordinates(group.toString(), "library", version.toString()) pom { - name = "Ling language" + name = "Lyng language" description = "Kotlin-bound scripting loanguage" inceptionYear = "2025" // url = "https://sergeych.net" diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Arguments.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Arguments.kt index 2cc1431..56ad849 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Arguments.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Arguments.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng data class ParsedArgument(val value: Statement, val pos: Pos, val isSplat: Boolean = false) diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/BuildDoubleFromParts.kt b/library/src/commonMain/kotlin/net/sergeych/ling/BuildDoubleFromParts.kt index edcc0cf..c1f60a5 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/BuildDoubleFromParts.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/BuildDoubleFromParts.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng //fun buildDoubleFromParts( // integerPart: Long, diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Compiler.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Compiler.kt index bcc7931..10deff2 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Compiler.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Compiler.kt @@ -1,7 +1,7 @@ -package net.sergeych.ling +package net.sergeych.lyng /** - * The LING compiler. + * The LYNG compiler. */ class Compiler( @Suppress("UNUSED_PARAMETER") diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/CompilerContext.kt b/library/src/commonMain/kotlin/net/sergeych/ling/CompilerContext.kt index a6d71fb..83f1e8f 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/CompilerContext.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/CompilerContext.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng internal class CompilerContext(val tokens: List) : ListIterator by tokens.listIterator() { val labels = mutableSetOf() diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Context.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Context.kt index cd5a3fe..0ccafc7 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Context.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Context.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class Context( val parent: Context?, diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ListEntry.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ListEntry.kt index 82dbb58..8b9463a 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ListEntry.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ListEntry.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng sealed class ListEntry { data class Element(val accessor: Accessor) : ListEntry() diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/LoopBreakContinueException.kt b/library/src/commonMain/kotlin/net/sergeych/ling/LoopBreakContinueException.kt index 39af279..e31faca 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/LoopBreakContinueException.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/LoopBreakContinueException.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class LoopBreakContinueException( val doContinue: Boolean, diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Obj.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Obj.kt index fe7cb97..fb03789 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Obj.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Obj.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjBool.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjBool.kt index 1fac6ab..772afea 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjBool.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjBool.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng data class ObjBool(val value: Boolean) : Obj() { override val asStr by lazy { ObjString(value.toString()) } diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt index 733bce5..2710460 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class ObjChar(val value: Char): Obj() { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjClass.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjClass.kt index 61aca8c..ecae5c1 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjClass.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjClass.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng val ObjClassType by lazy { ObjClass("Class") } diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjInt.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjInt.kt index 659dbe7..12a0deb 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjInt.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjInt.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng data class ObjInt(var value: Long) : Obj(), Numeric { override val asStr get() = ObjString(value.toString()) diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjList.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjList.kt index 1e82d62..560a524 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjList.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjList.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class ObjList(val list: MutableList) : Obj() { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjRange.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjRange.kt index 2fb51d2..a505239 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjRange.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjRange.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class ObjRange(val start: Obj?, val end: Obj?, val isEndInclusive: Boolean) : Obj() { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjRangeIterator.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjRangeIterator.kt index 592545e..0afc895 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjRangeIterator.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjRangeIterator.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class ObjRangeIterator(val self: ObjRange) : Obj() { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjReal.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjReal.kt index 7e6fc73..3c1b0d4 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjReal.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjReal.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng import kotlin.math.floor import kotlin.math.roundToLong diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ObjString.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ObjString.kt index bc2949a..7c3e031 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ObjString.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ObjString.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Parser.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Parser.kt index 3cdf7c2..c3c7c9f 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Parser.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Parser.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng val digitsSet = ('0'..'9').toSet() val digits = { d: Char -> d in digitsSet } diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Pos.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Pos.kt index f826fe8..03be38d 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Pos.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Pos.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng data class Pos(val source: Source, val line: Int, val column: Int) { override fun toString(): String { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Script.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Script.kt index 75234ed..a419bab 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Script.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Script.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng import kotlin.math.* diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/ScriptError.kt b/library/src/commonMain/kotlin/net/sergeych/ling/ScriptError.kt index d8f59e8..97ee0bf 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/ScriptError.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/ScriptError.kt @@ -1,6 +1,6 @@ @file:Suppress("CanBeParameter") -package net.sergeych.ling +package net.sergeych.lyng open class ScriptError(val pos: Pos, val errorMessage: String,cause: Throwable?=null) : Exception( """ diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Source.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Source.kt index 0a92d04..b339ce4 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Source.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Source.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng class Source(val fileName: String, text: String) { diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/StoredObj.kt b/library/src/commonMain/kotlin/net/sergeych/ling/StoredObj.kt index 193828f..2532704 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/StoredObj.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/StoredObj.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng /** * Whatever [Obj] stored somewhere diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/Token.kt b/library/src/commonMain/kotlin/net/sergeych/ling/Token.kt index 094f92a..556a47d 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/Token.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/Token.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng data class Token(val value: String, val pos: Pos, val type: Type) { val isComment: Boolean by lazy { type == Type.SINLGE_LINE_COMMENT || type == Type.MULTILINE_COMMENT } diff --git a/library/src/commonMain/kotlin/net/sergeych/ling/statements.kt b/library/src/commonMain/kotlin/net/sergeych/ling/statements.kt index da4f64d..3cde168 100644 --- a/library/src/commonMain/kotlin/net/sergeych/ling/statements.kt +++ b/library/src/commonMain/kotlin/net/sergeych/ling/statements.kt @@ -1,4 +1,4 @@ -package net.sergeych.ling +package net.sergeych.lyng fun String.toSource(name: String = "eval"): Source = Source(name, this) diff --git a/library/src/commonTest/kotlin/ScriptTest.kt b/library/src/commonTest/kotlin/ScriptTest.kt index 89ba50e..59ada48 100644 --- a/library/src/commonTest/kotlin/ScriptTest.kt +++ b/library/src/commonTest/kotlin/ScriptTest.kt @@ -1,7 +1,7 @@ package io.github.kotlin.fibonacci import kotlinx.coroutines.test.runTest -import net.sergeych.ling.* +import net.sergeych.lyng.* import kotlin.test.* class ScriptTest { diff --git a/library/src/jvmTest/kotlin/BookTest.kt b/library/src/jvmTest/kotlin/BookTest.kt index 962bf2e..aaf2a01 100644 --- a/library/src/jvmTest/kotlin/BookTest.kt +++ b/library/src/jvmTest/kotlin/BookTest.kt @@ -3,8 +3,8 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.test.runTest -import net.sergeych.ling.Context -import net.sergeych.ling.ObjVoid +import net.sergeych.lyng.Context +import net.sergeych.lyng.ObjVoid import java.nio.file.Files.readAllLines import java.nio.file.Paths import kotlin.test.Test