Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
f09150e
Adding Frontend to configurations and build general frontend structure
konradweiss Nov 6, 2025
7530437
Cleanup of basic structure
konradweiss Nov 7, 2025
bd942b7
Fix Build
konradweiss Nov 7, 2025
0ade67b
Adding builtin type names and operator overloading information to the…
konradweiss Nov 12, 2025
31df1db
Add initial jna call example before reconsidering
konradweiss Nov 14, 2025
367f04d
building uniffi with kotlin binding print_string
konradweiss Nov 18, 2025
3c2c28a
Fixing problems in rust frontend generation
konradweiss Nov 19, 2025
5cd4559
Add prebuild rustlibrary .so and kotlin bindings to the resources and…
konradweiss Nov 19, 2025
a5da5d0
rust export struct over ffi
konradweiss Nov 24, 2025
d4abc88
get source file file contents and call the parser
konradweiss Nov 28, 2025
173bb48
Return Optional and try to explore binding wrappers
konradweiss Dec 5, 2025
099a015
Restructure Ast node interfaces, add code location generation
konradweiss Dec 10, 2025
c99b2c4
More Enums and node wrappers
konradweiss Dec 10, 2025
343503c
Add params and ret type to Fn
konradweiss Dec 10, 2025
2879668
Binding stubs for parameters
konradweiss Dec 11, 2025
c310661
Dispatching structure for syntax node conversion structures
konradweiss Dec 30, 2025
0d52331
Add Problem node and fix ast node retrieval
konradweiss Dec 30, 2025
393370b
Adding Bloack expressions to functions
konradweiss Jan 7, 2026
eed0331
Handing through function body and let stmt components
konradweiss Jan 9, 2026
7f6de57
Name and let rust boilerplate, whith an issue of my approach with wit…
konradweiss Jan 9, 2026
de68870
Solving the infinit size data structure with a vector of size 0 or 1.…
konradweiss Jan 12, 2026
e602d3c
Arglist conversion
konradweiss Jan 12, 2026
e8dee4d
Handing over binary expression
konradweiss Jan 12, 2026
873b7e3
Macro Call and Expr
konradweiss Jan 13, 2026
e9359c6
Adding initial call and macro support
konradweiss Jan 14, 2026
6588d03
Adding struct support for records and tuples
konradweiss Jan 15, 2026
0a13484
Adding cargo build and bindings generation to the gradle build process
konradweiss Jan 15, 2026
73f98a1
Making rust build and bindings generation work from gradle
konradweiss Jan 16, 2026
06ad58b
Handing through declarations in impl block
konradweiss Jan 19, 2026
8dfdc80
Adding implementation handler and partially implementing it; Correcti…
konradweiss Jan 20, 2026
37ef377
Adding ExtensionDeclaration as a representative for the implementatio…
konradweiss Jan 23, 2026
aae7be9
Transport MethodCallExpression
konradweiss Jan 23, 2026
46012ed
Adding MethodCallExpression handling in frontend. We may have to wrap…
konradweiss Jan 25, 2026
3630ba6
MemberExpression as callee in a MemberCallExpression
konradweiss Jan 26, 2026
d36c0c1
Add Type transportation
konradweiss Jan 27, 2026
2fccee4
Add Tuple type and other base types
konradweiss Feb 2, 2026
12c3a02
Adding a return type to a function, parsing builtin types, and object…
konradweiss Feb 10, 2026
492c09f
Removing some unneeded template code and adding translation of Prefix…
konradweiss Feb 11, 2026
fa2945c
Remove old rust lib that was ment to use Rustc
konradweiss Feb 12, 2026
ff4ed3e
Type and supertype addition of impl block
konradweiss Feb 12, 2026
eaa7968
Better messages in Problem nodes
konradweiss Feb 13, 2026
342318b
Fixing some code ends and cast exception
konradweiss Feb 18, 2026
f5beae4
Handle Traits and Const
konradweiss Feb 24, 2026
71b2a38
Add Const init expression
konradweiss Feb 24, 2026
c334f60
Fix Problem Expression
konradweiss Feb 25, 2026
1c188a5
Allow Const du have empty init
konradweiss Feb 25, 2026
ea0b4ee
Merge branch 'main' into feature/language-rust
konradweiss Mar 13, 2026
392093a
Add If Else support
konradweiss Mar 16, 2026
e41a793
Adding support for loop, while and for stmt
konradweiss Mar 16, 2026
40e91a7
Add MemberAccess
konradweiss Mar 16, 2026
2fac5c8
Adding support for break and continue, especially for breaks to have …
konradweiss Mar 16, 2026
9eb11e6
Support Cast Expression
konradweiss Mar 16, 2026
68e631c
SUpporting index expressions as subscript expression
konradweiss Mar 18, 2026
e961dd0
Handle Reference Expression as unary operator with & operation and fo…
konradweiss Mar 18, 2026
75a515f
Merge branch 'main' into feature/language-rust
konradweiss Mar 20, 2026
be41b6c
Support Record Declaration and initializer based struct construction
konradweiss Mar 24, 2026
01d92c5
Adjusting base of spread argument in recrod expression
konradweiss Mar 25, 2026
030cd62
add tuple expression as initializer list
konradweiss Mar 25, 2026
ac9c8eb
Support Use expressions, flattening nested imports into a declaration…
konradweiss Mar 31, 2026
c374fc4
Fixing some keyword path issues for use, and fixes some paths for nam…
konradweiss Mar 31, 2026
91d9224
Adding functional tests for use, where we do not test the creation of…
konradweiss Apr 2, 2026
29bd3ef
Correct flag
konradweiss Apr 2, 2026
313f680
Add first deconstruction draft, and handling of match
konradweiss Apr 15, 2026
b70ec7f
Correct code and location raw nodes for match and its subnodes. Imple…
konradweiss Apr 15, 2026
b40050f
Match version with Variables as bindings
konradweiss Apr 20, 2026
3aa6156
Add declarations to scopes where missing. Support underscore expression
konradweiss Apr 21, 2026
2b4fa8c
Merge branch 'main' of github.com:Fraunhofer-AISEC/cpg
konradweiss Apr 21, 2026
cac6288
Merge branch 'main' into feature/language-rust
konradweiss Apr 21, 2026
ccb0475
Allow break to have empty expression. Implement basic try that modell…
konradweiss Apr 21, 2026
885d61a
Add Variants to union and generic params to all ast nodes in rust ast…
konradweiss Apr 22, 2026
8a96c2b
Finish the raemaining rust wrapper between rust analyzer and UniFFI
konradweiss Apr 30, 2026
d3bd7c0
Merge branch 'main' into feature/language-rust
konradweiss Apr 30, 2026
7d1bb9f
Add Let tests and adapt let expression
konradweiss May 4, 2026
b7f7a8f
Merge branch 'feature/language-rust' of github.com:Fraunhofer-AISEC/c…
konradweiss May 4, 2026
0af6596
Addapt Let statement, add test for dfg edges based on literals
konradweiss May 4, 2026
ec5102c
Adding Closure and Enum support
konradweiss May 6, 2026
d7473ea
Fix issue in fro loop, implement structural test with few df asserts …
konradweiss May 11, 2026
ce36ff0
Merge branch 'main' into feature/language-rust
konradweiss May 11, 2026
75e14f7
Add whitelisting file
konradweiss May 12, 2026
035a9bd
Merge branch 'fix/allow-esbuild-scripts' into feature/language-rust
konradweiss May 12, 2026
e78ad83
Merge branch 'feature/language-rust' of github.com:Fraunhofer-AISEC/c…
konradweiss May 12, 2026
d73511b
Add test for alternative in match
konradweiss May 12, 2026
2b4f755
df structures
konradweiss May 12, 2026
1d9d104
Add more refined dfg granularities for deconstruction
konradweiss May 19, 2026
c5c3adc
Adapt gradle task
konradweiss May 20, 2026
1e6f404
Correct package before library move
konradweiss Jun 9, 2026
88817e1
Merge branch 'main' into feature/language-rust
konradweiss Jun 9, 2026
5f5ac70
Using native lib from libast
konradweiss Jun 9, 2026
ade007a
Fixing Empty ParenExpression, and Empty expression is returned
konradweiss Jun 9, 2026
b006e57
Revert "Update dependency io.ktor.plugin to v3.5.0 (#2742)"
maximiliankaul Jun 9, 2026
c4f0ae4
Change the ktor dependency to API to allow usage in other projects
maximiliankaul Jun 10, 2026
fc22967
Change Ktor dependencies from api to implementation for non-CIO
maximiliankaul Jun 10, 2026
13a73e1
Merge remote-tracking branch 'origin/restore-ktor-3.3.3' into feature…
konradweiss Jun 10, 2026
6def724
Merge remote-tracking branch 'origin/ktor-api-dependency' into featur…
konradweiss Jun 10, 2026
56ac5e6
Enable the Rust frontend in the example file
maximiliankaul Jun 10, 2026
563ad0e
Ignoring tests temporarely for snapshot build
konradweiss Jun 11, 2026
6b82528
Merge branch 'feature/language-rust' of github.com:Fraunhofer-AISEC/c…
konradweiss Jun 11, 2026
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
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ val enablePythonFrontend: Boolean by extra {
}
project.logger.lifecycle("Python frontend is ${if (enablePythonFrontend) "enabled" else "disabled"}")

val enableRustFrontend: Boolean by extra {
val enableRustFrontend: String? by project
enableRustFrontend.toBoolean()
}
project.logger.lifecycle("Rust frontend is ${if (enableRustFrontend) "enabled" else "disabled"}")

val enableLLVMFrontend: Boolean by extra {
val enableLLVMFrontend: String? by project
enableLLVMFrontend.toBoolean()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ val enablePythonFrontend: Boolean by rootProject.extra
val enableLLVMFrontend: Boolean by rootProject.extra
val enableTypeScriptFrontend: Boolean by rootProject.extra
val enableRubyFrontend: Boolean by rootProject.extra
val enableRustFrontend: Boolean by rootProject.extra
val enableJVMFrontend: Boolean by rootProject.extra
val enableINIFrontend: Boolean by rootProject.extra

Expand Down Expand Up @@ -38,6 +39,9 @@ dependencies {
if (enableRubyFrontend) {
implementation(project(":cpg-language-ruby"))
}
if (enableRustFrontend) {
implementation(project(":cpg-language-rust"))
}
if (enableINIFrontend) {
implementation(project(":cpg-language-ini"))
}
Expand Down
2 changes: 2 additions & 0 deletions configure_frontends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ answerGo=$(ask "Do you want to enable the Go frontend? (currently $(getProperty
setProperty "enableGoFrontend" $answerGo
answerPython=$(ask "Do you want to enable the Python frontend? (currently $(getProperty "enablePythonFrontend"))")
setProperty "enablePythonFrontend" $answerPython
answerRust=$(ask "Do you want to enable the Rust frontend? (currently $(getProperty "enableRustFrontend"))")
setProperty "enableRustFrontend" $answerRust
answerLLVM=$(ask "Do you want to enable the LLVM frontend? (currently $(getProperty "enableLLVMFrontend"))")
setProperty "enableLLVMFrontend" $answerLLVM
answerTypescript=$(ask "Do you want to enable the TypeScript frontend? (currently $(getProperty "enableTypeScriptFrontend"))")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,51 @@ fun MetadataProvider.newThrow(rawNode: Any? = null): Throw {
return node
}

/**
* Creates a new [ObjectDeconstruction]. The [MetadataProvider] receiver will be used to fill
* different meta-data using [Node.applyMetadata]. Calling this extension function outside of Kotlin
* requires an appropriate [MetadataProvider], such as a [LanguageFrontend] as an additional
* prepended argument.
*/
@JvmOverloads
fun MetadataProvider.newObjectDeconstruction(rawNode: Any? = null): ObjectDeconstruction {
val node = ObjectDeconstruction()
node.applyMetadata(this, EMPTY_NAME, rawNode, true)

log(node)
return node
}

/**
* Creates a new [NamedDeconstruction]. The [MetadataProvider] receiver will be used to fill
* different meta-data using [Node.applyMetadata]. Calling this extension function outside of Kotlin
* requires an appropriate [MetadataProvider], such as a [LanguageFrontend] as an additional
* prepended argument.
*/
@JvmOverloads
fun MetadataProvider.newNamedDeconstruction(rawNode: Any? = null): NamedDeconstruction {
val node = NamedDeconstruction()
node.applyMetadata(this, EMPTY_NAME, rawNode, true)

log(node)
return node
}

/**
* Creates a new [AlternativeDeconstruction]. The [MetadataProvider] receiver will be used to fill
* different meta-data using [Node.applyMetadata]. Calling this extension function outside of Kotlin
* requires an appropriate [MetadataProvider], such as a [LanguageFrontend] as an additional
* prepended argument.
*/
@JvmOverloads
fun MetadataProvider.newAlternativeDeconstruction(rawNode: Any? = null): AlternativeDeconstruction {
val node = AlternativeDeconstruction()
node.applyMetadata(this, EMPTY_NAME, rawNode, true)

log(node)
return node
}

/**
* Creates a new [ProblemExpression]. The [MetadataProvider] receiver will be used to fill different
* meta-data using [Node.applyMetadata]. Calling this extension function outside of Kotlin requires
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2026, Fraunhofer AISEC. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
package de.fraunhofer.aisec.cpg.graph.declarations

import de.fraunhofer.aisec.cpg.graph.DeclarationHolder
import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.edges.ast.astEdgesOf
import de.fraunhofer.aisec.cpg.graph.edges.unwrapping
import java.util.Objects

/**
* Children in this declaration are added to an existing node with namespace. This can be a Record,
* or another similar construct that contains declarations. The children are therefore in this ast
* construct but are added to the symbol table of the construct it is extending.
*
* The name that this extension has needs to identify the construct, it is extending
*/
class ExtensionDeclaration : Declaration(), DeclarationHolder {
Comment thread
konradweiss marked this conversation as resolved.
/**
* Edges to nested namespaces, records, functions, fields etc. contained in the current
* namespace.
*/
val declarationEdges = astEdgesOf<Declaration>()
override val declarations by unwrapping(ExtensionDeclaration::declarationEdges)

/**
* In some languages, there is a relationship between paths / directories and the package
* structure. Therefore, we need to be aware of the path this namespace / package is in.
*/
var path: String? = null

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ExtensionDeclaration) return false
return super.equals(other) && declarations == other.declarations
}

override fun hashCode() = Objects.hash(super.hashCode(), declarations)

override fun addDeclaration(declaration: Declaration) {
addIfNotContains(declarations, declaration)
}

override fun getStartingPrevEOG(): Collection<Node> {
return setOf()
}

override fun getExitNextEOG(): Collection<Node> {
return setOf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2026, Fraunhofer AISEC. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
package de.fraunhofer.aisec.cpg.graph.expressions

import de.fraunhofer.aisec.cpg.graph.ArgumentHolder
import de.fraunhofer.aisec.cpg.graph.edges.ast.astEdgesOf
import de.fraunhofer.aisec.cpg.graph.edges.unwrapping
import de.fraunhofer.aisec.cpg.graph.types.HasType
import de.fraunhofer.aisec.cpg.graph.types.Type
import de.fraunhofer.aisec.cpg.persistence.Relationship
import java.util.Objects
import kotlin.collections.plusAssign

class AlternativeDeconstruction : Deconstruction(), ArgumentHolder, HasType.TypeObserver {

@Relationship("ALTERNATIVES") var alternativeEdges = astEdgesOf<Expression>()
var alternatives by unwrapping(AlternativeDeconstruction::alternativeEdges)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is AlternativeDeconstruction) return false
return super.equals(other) && alternatives == other.alternatives
}

override fun hashCode() = Objects.hash(super.hashCode(), alternatives)

override fun addArgument(expression: Expression) {
this.alternatives += expression
expression.access = this.access
}

override fun replaceArgument(old: Expression, new: Expression): Boolean {
val idx = alternativeEdges.indexOfFirst { it.end == old }
if (idx != -1) {
old.unregisterTypeObserver(this)
alternativeEdges[idx].end = new
new.registerTypeObserver(this)
new.access = this.access
return true
}

return false
}

override fun hasArgument(expression: Expression): Boolean {
return expression in this.alternatives
}

override fun typeChanged(newType: Type, src: HasType) {
val type = type
typeObservers.forEach { it.typeChanged(type, this) }
}

override fun assignedTypeChanged(assignedTypes: Set<Type>, src: HasType) {
addAssignedTypes(assignedTypes)
typeObservers.forEach { it.assignedTypeChanged(assignedTypes, this) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,58 @@
package de.fraunhofer.aisec.cpg.graph.expressions

import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.edges.ast.astOptionalEdgeOf
import de.fraunhofer.aisec.cpg.graph.edges.unwrapping
import de.fraunhofer.aisec.cpg.graph.types.HasType
import de.fraunhofer.aisec.cpg.graph.types.Type
import de.fraunhofer.aisec.cpg.persistence.Relationship
import java.util.Objects

/**
* Expression used to interrupt further execution of a loop body and exit the respective loop
* context. Can have a loop label, e.g. in Java, to specify which of the nested loops should be
* broken out of.
*/
class Break : Expression(false) {
class Break : Expression(false), HasType.TypeObserver {

/** Specifies the label of the loop in a nested structure that this statement will 'break' */
var label: String? = null

@Relationship("EXPR")
var exprEdge =
astOptionalEdgeOf<Expression>(
onChanged = { old, new -> exchangeTypeObserverWithAccessPropagation(old, new) }
)
/** The expression on which the operation is applied. */
var expr by unwrapping(Break::exprEdge)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Break) return false
return super.equals(other) && label == other.label
return super.equals(other) && label == other.label && expr == other.expr
}

override fun hashCode() = Objects.hash(super.hashCode(), label)
override fun hashCode() = Objects.hash(super.hashCode(), label, expr)

override fun getStartingPrevEOG(): Collection<Node> {
return this.prevEOG
}

override fun typeChanged(newType: Type, src: HasType) {
if (src != expr) {
return
}

this.type = newType
}

override fun assignedTypeChanged(assignedTypes: Set<Type>, src: HasType) {
// Only accept type changes from out input
if (src != expr) {
return
}

// Apply our operator to all assigned types and forward them to us
this.addAssignedTypes(assignedTypes)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2026, Fraunhofer AISEC. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
package de.fraunhofer.aisec.cpg.graph.expressions

abstract class Deconstruction : Expression()
Loading
Loading