https://github.com/ogstudio/cross-language-dialect
Rules and tools for portable code | Правила и инструменты для портируемого кода
https://github.com/ogstudio/cross-language-dialect
cpp javascript kotlin python swift
Last synced: about 1 month ago
JSON representation
Rules and tools for portable code | Правила и инструменты для портируемого кода
- Host: GitHub
- URL: https://github.com/ogstudio/cross-language-dialect
- Owner: OGStudio
- License: cc0-1.0
- Created: 2024-07-05T19:25:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-25T19:28:18.000Z (9 months ago)
- Last Synced: 2025-05-25T19:43:39.597Z (9 months ago)
- Topics: cpp, javascript, kotlin, python, swift
- Language: Kotlin
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: history/README.md
- License: LICENSE
Awesome Lists containing this project
README
Cross-language dialect (**CLD**) is a set of tools and rules to write
portable code for select programming languages at once.
Context and Entities keep the state (data), they are described in YML and
can be converted to:
* Kotlin
# JavaScript
Run tests in a web browser by opening `./javascript/do-test.html`
# Swift
Build tests on macOS:
$ `./swift/make`
Run tests on macOS:
$ `./swift/do-test`
# Kotlin
Build tests on macOS:
$ `./kotlin/make`
Run tests on macOS:
$ `./kotlin/do-test`
# Translator
Build translator:
$ `cd translator && ./gradlew jar`
Parse entities' YML:
$ `cd translator && ./run/run-java --file=../test/test-dir/entities.yml --out=../test/test-dir/entities.kt --dbg`
# Current availability of functions
## Generation of entities
| № | Type | JavaScript | Kotlin | Swift |
|---|--- |--- |--- |--- |
| 1 | struct | X | √ | X |
| 2 | context | X | √ | X |
## Generation of entity fields for Kotlin
| № | YML type | Kotlin type | Default value | YML example | Kotlin example |
|---|--- |--- |--- |--- |--- |
| 1 | `Bool` | `Boolean` | `false` | `didLaunch: Bool` | `var didLaunch: Boolean = false` |
| 2 | `String` | `String` | `""` | `method: String` | `var method: String = ""` |
| 3 | `[Type]` | `Array` | `arrayOf()` | `arguments: [String]` | `var arguments: Array = arrayOf()` |
| 4 | `[TypeA: TypeB]` | `Map` | `mapOf()` | `templates: [String: String]` | `var templates: Map = mapOf()` |
# Utilities
Updating the version in all files:
$ `./util/update-vesion 1.0.1 1.1.0`