Skip to content

Commit a68bf2e

Browse files
committed
feat(rust): init modules
1 parent 4ed75de commit a68bf2e

File tree

11 files changed

+1707
-12
lines changed

11 files changed

+1707
-12
lines changed

README.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,38 @@ Chapi => Cha Pi => Tea Pi => Tea π => 茶 π. See on in refs: [Tea if by sea, c
1313

1414
Languages Stages (Welcome to PR your usage languages)
1515

16-
| Features/Languages | Java | Python | Go | Kotlin | TypeScript | C | C# | Scala | C++ |
17-
|---------------------|------|--------|-----|--------|------------|-----|-----|-------|-----|
18-
| http api decl || 🆕 | 🆕 ||| 🆕 | 🆕 | | |
19-
| syntax parse |||||| 🆕 | 🆕 || 🆕 |
20-
| function call || 🆕 | 🆕 | 🆕 || | | | |
21-
| arch/package || | ||| | || |
22-
| real world validate || | | 🆕 || | | | |
16+
| Features/Languages | Java | Python | Go | Kotlin | TypeScript | C | C# | Scala | C++ | Rust |
17+
|---------------------|------|--------|-----|--------|------------|-----|-----|-------|-----|------|
18+
| http api decl || 🆕 | 🆕 ||| 🆕 | 🆕 | | | |
19+
| syntax parse |||||| 🆕 | 🆕 || 🆕 | |
20+
| function call || 🆕 | 🆕 | 🆕 || | | | | |
21+
| arch/package || | ||| | || | |
22+
| real world validate || | | 🆕 || | | | | |
2323
| expression (TBD) | | | | | | | | | |
2424

2525
language versions(tested):
2626

2727
- Java: 8, 11, 17
28-
- C#: .NET 6.0
28+
- TypeScript
29+
- Kotlin
2930
- Python: 2, 3
3031

32+
// tier 1 languages
33+
":chapi-ast-java",
34+
":chapi-ast-typescript",
35+
36+
// tier 2 languages
37+
":chapi-ast-kotlin",
38+
":chapi-ast-go",
39+
":chapi-ast-python",
40+
":chapi-ast-scala",
41+
42+
// tier 3 languages
43+
":chapi-ast-rust",
44+
":chapi-ast-csharp",
45+
":chapi-ast-c",
46+
":chapi-ast-cpp",
47+
3148
Language Family [wiki](https://en.wikipedia.org/wiki/First-class_function)
3249

3350
Algol Family [https://wiki.c2.com/?AlgolFamily](https://wiki.c2.com/?AlgolFamily)

chapi-ast-rust/build.gradle.kts

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
plugins {
2+
id("antlr")
3+
java
4+
kotlin("jvm")
5+
kotlin("plugin.serialization") version "1.6.10"
6+
7+
`jacoco-conventions`
8+
}
9+
10+
repositories {
11+
mavenCentral()
12+
mavenLocal()
13+
}
14+
15+
dependencies {
16+
antlr("org.antlr:antlr4:4.11.1")
17+
18+
// project deps
19+
implementation(project(":chapi-domain"))
20+
21+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
22+
23+
implementation(kotlin("stdlib-jdk8"))
24+
implementation(kotlin("reflect"))
25+
// Kotlin reflection.
26+
implementation(kotlin("test"))
27+
implementation(kotlin("test-junit"))
28+
29+
// JUnit 5
30+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
31+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")
32+
testRuntimeOnly("org.junit.platform:junit-platform-console:1.6.0")
33+
34+
implementation("org.antlr:antlr4:4.11.1")
35+
implementation("org.antlr:antlr4-runtime:4.11.1")
36+
}
37+
38+
sourceSets.main {
39+
java.srcDirs("${project.buildDir}/generated-src")
40+
}
41+
42+
tasks.generateGrammarSource {
43+
maxHeapSize = "64m"
44+
arguments = arguments + listOf("-package", "chapi.ast.antlr") + listOf("-visitor", "-long-messages")
45+
outputDirectory = file("${project.buildDir}/generated-src/chapi/ast/antlr")
46+
}
47+
48+
tasks.withType<AntlrTask> {
49+
50+
}
51+
52+
tasks.named("compileKotlin") {
53+
dependsOn(tasks.withType<AntlrTask>())
54+
}
55+
56+
tasks.withType<Test> {
57+
useJUnitPlatform()
58+
testLogging {
59+
events("passed", "skipped", "failed")
60+
}
61+
}

0 commit comments

Comments
 (0)