compiler, runtime: Begin Runtime Refactor
Continuous Integration / Grammar Tests (push) Failing after 39s
Continuous Integration / Library Format Tests (push) Successful in 1m46s
Continuous Integration / Library Tests (push) Successful in 4m38s

Ultimately, the goal is to completely separate the compilation from
the runtime to make it possible to have the interpreter/evaluator
be "just another" entity that can perform meaningful work when
given a parsed GP4 program.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-29 08:41:49 -04:00
parent 18461a9215
commit 44e93e4cda
30 changed files with 1264 additions and 854 deletions
+13 -13
View File
@@ -20,28 +20,28 @@ import Common
public struct Statement {}
public struct VariableDeclarationStatement {
public var initializer: EvaluatableExpression
public var identifier: Identifier
public init(identifier: Identifier, withInitializer initializer: EvaluatableExpression) {
public var initializer: P4Expression
public var identifier: TypedIdentifier
public init(identifier: TypedIdentifier, withInitializer initializer: P4Expression) {
self.identifier = identifier
self.initializer = initializer
}
}
public struct ConditionalStatement {
public var condition: EvaluatableExpression
public var thenn: EvaluatableStatement
public var elss: EvaluatableStatement?
public var condition: P4Expression
public var thenn: P4Statement
public var elss: P4Statement?
public init(condition: EvaluatableExpression, withThen thenn: EvaluatableStatement) {
public init(condition: P4Expression, withThen thenn: P4Statement) {
self.condition = condition
self.thenn = thenn
self.elss = .none
}
public init(
condition: EvaluatableExpression, withThen thenn: EvaluatableStatement,
andElse elss: EvaluatableStatement
condition: P4Expression, withThen thenn: P4Statement,
andElse elss: P4Statement
) {
self.condition = condition
self.thenn = thenn
@@ -50,18 +50,18 @@ public struct ConditionalStatement {
}
public struct BlockStatement {
public var statements: [EvaluatableStatement]
public var statements: [P4Statement]
public init(_ statements: [EvaluatableStatement]) {
public init(_ statements: [P4Statement]) {
self.statements = statements
}
}
public struct ReturnStatement {
public let value: EvaluatableExpression
public let value: P4Expression
public init(_ value: EvaluatableExpression) {
public init(_ value: P4Expression) {
self.value = value
}
}