-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/declarative_builtins' into 'master'
Implement a built-in registration system akin to TruffleRuby's See merge request eng/libadalang/langkit-query-language!379
- Loading branch information
Showing
58 changed files
with
2,114 additions
and
2,527 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>lkql_jit</artifactId> | ||
<groupId>com.adacore</groupId> | ||
<version>0.1.0</version> | ||
</parent> | ||
|
||
<artifactId>builtins_annotations</artifactId> | ||
<version>0.1.0</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.graalvm.truffle</groupId> | ||
<artifactId>truffle-api</artifactId> | ||
<version>${graalvm.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.graalvm.truffle</groupId> | ||
<artifactId>truffle-dsl-processor</artifactId> | ||
<version>${graalvm.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<!-- Skip the Spotless check because everything is handled by the parent --> | ||
<plugin> | ||
<groupId>com.diffplug.spotless</groupId> | ||
<artifactId>spotless-maven-plugin</artifactId> | ||
<version>2.40.0</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<compilerArgs> | ||
<arg>--add-exports</arg> | ||
<arg>org.graalvm.truffle/com.oracle.truffle.api.dsl=ALL-UNNAMED</arg> | ||
<compilerArgument>-proc:none</compilerArgument> | ||
</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
23 changes: 23 additions & 0 deletions
23
.../builtins_annotations/src/main/java/com/adacore/lkql_jit/annotations/BuiltInFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Copyright (C) 2005-2024, AdaCore | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
package com.adacore.lkql_jit.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Annotation to add a new built-in function to LKQL. Those annotations are automatically processed | ||
* by the BuiltInProcessor Java processor. | ||
*/ | ||
@Target(ElementType.TYPE) | ||
public @interface BuiltInFunction { | ||
|
||
/** Name for this built-in function */ | ||
String name(); | ||
|
||
/** Documentation for this built-in function */ | ||
String doc(); | ||
} |
34 changes: 34 additions & 0 deletions
34
...it/builtins_annotations/src/main/java/com/adacore/lkql_jit/annotations/BuiltInMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Copyright (C) 2005-2024, AdaCore | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
package com.adacore.lkql_jit.annotations; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Annotation to add a new built-in method to LKQL. Those annotations are automatically processed by | ||
* the BuiltInProcessor Java processor. | ||
*/ | ||
@Target(ElementType.TYPE) | ||
public @interface BuiltInMethod { | ||
|
||
/** Name for this built-in method. */ | ||
String name() default ""; | ||
|
||
/** Documentation for this built-in method. */ | ||
String doc() default ""; | ||
|
||
/** | ||
* Types that this method should be added onto. Note that if the final computed set is empty, | ||
* method will be added on all types. | ||
*/ | ||
String[] targetTypes() default {}; | ||
|
||
/** | ||
* Whether method is a property. A property is a built-in method that doesn't need any | ||
* arguments, and that doesn't take parens when you call it. | ||
*/ | ||
boolean isProperty() default false; | ||
} |
Oops, something went wrong.