Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experiments #30

Merged
merged 35 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9f12103
Adding the context functionality for Lushu.
Vitor-Git15 Jun 12, 2023
f94e64d
Adding implementation for context grammar
Vitor-Git15 Jul 12, 2023
1a8836b
Code modification to maintain consistency in code formatting
Vitor-Git15 Jul 15, 2023
ac3fb29
Merge branch 'main' into add-context
Vitor-Git15 Jul 15, 2023
829a6bf
Removing .idea folder
Vitor-Git15 Jul 15, 2023
27928a0
Merge branch 'add-context' of github.com:lac-dcc/lushu into add-context
Vitor-Git15 Jul 15, 2023
2061a1a
Fix codes
Vitor-Git15 Jul 17, 2023
f2849ed
Removing files
Vitor-Git15 Jul 17, 2023
2f9257f
Adding some unit tests for Context Grammar.
Vitor-Git15 Aug 3, 2023
a27b870
Adding more unit tests for Context Grammar
Vitor-Git15 Aug 4, 2023
2006372
Adding more unit tests for Context Grammar
Vitor-Git15 Aug 4, 2023
2681aba
Adding Node interfaces and implementing their respective methods
Vitor-Git15 Aug 11, 2023
d9dfb0b
Resolving conflicts
Vitor-Git15 Aug 11, 2023
17eb31f
Adding 'meet' method to GrammarNode class
Vitor-Git15 Aug 14, 2023
ec04374
Initiating Merger and ContextGrammar Integration, and adding star fun…
Vitor-Git15 Aug 23, 2023
8b3c8a8
Introducing star (*) matching, adding web crawling functionality to L…
Vitor-Git15 Aug 28, 2023
6358723
Adding partial integration between GrammarContext and the Merger
Vitor-Git15 Sep 1, 2023
eeabfd2
Fixing integration bugs
Vitor-Git15 Sep 3, 2023
5b474b4
Adding integration
Vitor-Git15 Sep 7, 2023
d0038a6
Completion of the integration between ContextGrammar and the Merger
Vitor-Git15 Sep 7, 2023
3c43b0f
Merge branch 'main' of github.com:lac-dcc/lushu into integrate-contex…
Vitor-Git15 Sep 16, 2023
f912370
Adding HTML grammar
Vitor-Git15 Oct 17, 2023
cf56a6b
Adding map grammar implementation
Vitor-Git15 Oct 23, 2023
e0c861b
Fixing bugs and preparing the grammar for test execution.
Vitor-Git15 Oct 25, 2023
dc4a2fd
Preparing data and functions for stress testing.
Vitor-Git15 Oct 25, 2023
781f45b
Adding htmls files to gitignore
Vitor-Git15 Oct 25, 2023
8ae908d
Removing all html files
Vitor-Git15 Oct 25, 2023
4b79268
Adding tests to Lushu and BeautifulSoup
Vitor-Git15 Oct 26, 2023
fc9bba7
Adding stress test between Lushu and BeautifulSoup
Vitor-Git15 Oct 28, 2023
f617618
Adding comparison tests
Vitor-Git15 Oct 31, 2023
1c730a0
Clean code (#31)
Yowgf Nov 6, 2023
c351b7a
Improve readme
Yowgf Nov 6, 2023
167b407
Remove descendent parser implementation
Yowgf Nov 6, 2023
078234c
Fix nit
Yowgf Nov 6, 2023
e53b1f7
Add PR template
Yowgf Nov 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

# Directory
Lushu/src/main/kotlin/lushu/ContextGrammar/out
example/html/html_files
example/C/C_files
test/context_tests/compare_to_beautifulsoup/emails
test/context_tests/compare_to_beautifulsoup/results

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
Expand All @@ -32,6 +36,9 @@ hs_err_pid*
*#*
**~

# VSCode
.vscode

.gradle
.idea

Expand Down
47 changes: 0 additions & 47 deletions .gitignore.save

This file was deleted.

183 changes: 66 additions & 117 deletions Lushu/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ repositories {
plugins {
kotlin("jvm") version "1.8.22"

// Apply the application plugin to add support for building a CLI
// application.
// The application plugin enables building a CLI application.
application

// This pluging allows greater flexibility in customizing test builds.
// This plugin allows greater flexibility in customizing test builds.
id("org.unbroken-dome.test-sets") version "4.0.0"
}

Expand All @@ -30,98 +29,20 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api")
}

val fatJar = task("fatJar", type = Jar::class) {
description = "Creates a self-contained fat JAR of the application."
manifest {
attributes(
mapOf(
"Implementation-Title" to "Lushu",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.AppKt"
)
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
with(tasks.jar.get())
}

val grammarJar = task("grammarJar", type = Jar::class) {
archiveBaseName.set("Grammar")
manifest {
attributes(
mapOf(
"Implementation-Title" to "Grammar",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.Grammar.AppKt"
)
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
with(tasks.jar.get())
}

val mergerJar = task("mergerJar", type = Jar::class) {
archiveBaseName.set("Merger")
manifest {
attributes(
mapOf(
"Implementation-Title" to "Merger",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.Merger.AppKt"
)
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
with(tasks.jar.get())
}

val stressTestWithLushuJar =
task("stressTestWithLushuJar", type = Jar::class) {
archiveBaseName.set("StressTestWithLushu")
manifest {
attributes(
mapOf(
"Implementation-Title" to "StressTestWithLushu",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.TestApps.StressTest.WithLushu.AppKt"
)
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
with(tasks.jar.get())
}

val stressTestWoutLushuJar =
task("stressTestWoutLushuJar", type = Jar::class) {
archiveBaseName.set("StressTestWoutLushu")
fun newJarTask(
name: String,
desc: String,
packagePath: String,
manifestAttributes: Map<String, String> = mapOf(
"Implementation-Title" to "Lushu",
"Implementation-Version" to "0.1",
"Main-Class" to packagePath
)
): Task {
return task(name, type = Jar::class) {
description = desc
manifest {
attributes(
mapOf(
"Implementation-Title" to "StressTestWoutLushu",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.TestApps.StressTest.WoutLushu.AppKt"
)
)
attributes(manifestAttributes)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
Expand All @@ -131,27 +52,55 @@ val stressTestWoutLushuJar =
from(dependencies)
with(tasks.jar.get())
}
}

val stressTestGrammarStatisticsJar =
task("stressTestGrammarStatisticsJar", type = Jar::class) {
archiveBaseName.set("StressTestGrammarStatistics")
manifest {
attributes(
mapOf(
"Implementation-Title" to "StressTestGrammarStatistics",
"Implementation-Version" to "0.1",
"Main-Class" to "lushu.TestApps.StressTest.GrammarStatistics.AppKt"
)
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
with(tasks.jar.get())
}
val fatJar = newJarTask(
"fatJar",
"Creates a self-contained fat JAR of the application.",
"lushu.Appkt"
)

newJarTask(
"grammarJar",
"Application to play with Lushu Grammar.",
"lushu.Grammar.AppKt"
)

newJarTask(
"mergerJar",
"Application to play with Lushu Merger.",
"lushu.Merger.AppKt"
)

newJarTask(
"generatorJar",
"Application to generate test files",
"lushu.ContextGrammar.GeneratorAppKt"
)

newJarTask(
"stressTestMapWithLushuJar",
"Application to test Lushu Map Grammar implementation.",
"lushu.TestApps.StressTest.Context.WithLushu.AppKt"
)

newJarTask(
"stressTestWithLushuJar",
"Application to test stable Lushu implementation.",
"lushu.TestApps.StressTest.WithLushu.AppKt"
)

newJarTask(
"stressTestWoutLushuJar",
"Application to test base case (program running without Lushu interception) against Lushu.",
"lushu.TestApps.StressTest.WoutLushu.AppKt"
)

newJarTask(
"stressTestGrammarStatisticsJar",
"Application to get some statistics about the Lushu Grammar after running against some benchmark.",
"lushu.TestApps.StressTest.GrammarStatistics.AppKt"
)

tasks {
"build" {
Expand Down Expand Up @@ -212,9 +161,9 @@ tasks.test {
logger.lifecycle("Test result: ${result.resultType}")
logger.lifecycle(
"Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
)
failedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tFailed Tests")
skippedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tSkipped Tests:")
Expand Down
29 changes: 29 additions & 0 deletions Lushu/src/main/kotlin/lushu/ContextGrammar/GeneratorApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package lushu.ContextGrammar

import lushu.ContextGrammar.Grammar.CGenerator
import lushu.ContextGrammar.Grammar.HTMLGenerator

val HTML_OPT = 0
val C_OPT = 1
fun main(args: Array<String>) {
if (args.size < 3) {
println(
"Usage: <this-program> <generator-type> <output-file> <number-of-tokens>"
)
return
}

val option: Int = args[0].toInt()
val file: String = args[1]
val numTokens: Int = args[2].toInt()
if (option == HTML_OPT) {
HTMLGenerator().startGenerator(numTokens, file)
} else if (option == C_OPT) {
CGenerator().startGenerator(numTokens, file)
} else {
println(
"options:\nHTML = 0\nC = 1\n"
)
return
}
}
Loading