Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
.gradle

build
bin
bin
35 changes: 11 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@ sourceSets {
srcDirs = ['src/test/java']
}
}
playground {
java {
srcDirs = ['src/playground/java']
}
}
}

dependencies {
implementation platform('org.junit:junit-bom:5.10.3')
implementation 'org.junit.jupiter:junit-jupiter'

testImplementation platform('org.junit:junit-bom:5.10.3')
testImplementation 'org.junit.jupiter:junit-jupiter'

testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

playgroundImplementation sourceSets.main.output
// playgroundImplementation configurations.implementation
// playgroundRuntimeOnly configurations.runtimeClasspath
}

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
Expand All @@ -54,25 +49,17 @@ tasks.named('test') {
events = [TestLogEvent.STARTED, TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_ERROR, TestLogEvent.STANDARD_OUT]
exceptionFormat = TestExceptionFormat.FULL
}

info.events = debug.events
info.exceptionFormat = debug.exceptionFormat

afterSuite { desc, result ->
if (desc.parent) return

def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()

println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
if (!desc.parent) {
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}

tasks.register('playground', JavaExec) {
group = 'application'
description = 'Runs the playground main method'
classpath = sourceSets.playground.runtimeClasspath
mainClass = 'Test'
}
1,283 changes: 0 additions & 1,283 deletions docs/diagrams/CustomCompilers.drawio.svg

This file was deleted.

728 changes: 0 additions & 728 deletions docs/diagrams/Storage.drawio.svg

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
15 changes: 8 additions & 7 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 25 additions & 9 deletions src/main/java/component_construction/Compiler.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package component_construction;
import syntax_analysis.parsing.ParseFailedException;

public interface Compiler {
import code_generation.CodeGenerator;
import grammar_objects.Token;
import lexical_analysis.LexicalAnalyser;
import syntax_analysis.SyntaxAnalyser;
import syntax_analysis.parsing.ParseFailedException;
import syntax_analysis.parsing.ParseState;

/**
* Compiles an input sentence
* @param input The sentence to be compiled
* @return The output of compilation
* @throws ParseFailedException An error occurred when parsing the sentence
*/
public String compile(String input) throws ParseFailedException;
public class Compiler {
protected LexicalAnalyser lexicalAnalyser;
protected SyntaxAnalyser syntaxAnalyser;
protected CodeGenerator codeGenerator;

public Compiler(
LexicalAnalyser lexicalAnalyser,
SyntaxAnalyser syntaxAnalyser,
CodeGenerator codeGenerator
) {
this.lexicalAnalyser = lexicalAnalyser;
this.syntaxAnalyser = syntaxAnalyser;
this.codeGenerator = codeGenerator;
}

public String compile(String input) throws ParseFailedException {
Token[] tokens = lexicalAnalyser.analyse(input);
ParseState parseRoot = syntaxAnalyser.analyse(tokens);
return codeGenerator.generate(parseRoot);
}
}
Loading
Loading