Skip to content

Commit 9069e57

Browse files
committed
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
2 parents 1030a84 + f86c013 commit 9069e57

File tree

58 files changed

+2114
-2527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2114
-2527
lines changed

lkql_jit/.idea/codeStyles/Project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>lkql_jit</artifactId>
9+
<groupId>com.adacore</groupId>
10+
<version>0.1.0</version>
11+
</parent>
12+
13+
<artifactId>builtins_annotations</artifactId>
14+
<version>0.1.0</version>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.graalvm.truffle</groupId>
19+
<artifactId>truffle-api</artifactId>
20+
<version>${graalvm.version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.graalvm.truffle</groupId>
24+
<artifactId>truffle-dsl-processor</artifactId>
25+
<version>${graalvm.version}</version>
26+
<scope>provided</scope>
27+
</dependency>
28+
</dependencies>
29+
30+
<build>
31+
<plugins>
32+
<!-- Skip the Spotless check because everything is handled by the parent -->
33+
<plugin>
34+
<groupId>com.diffplug.spotless</groupId>
35+
<artifactId>spotless-maven-plugin</artifactId>
36+
<version>2.40.0</version>
37+
<configuration>
38+
<skip>true</skip>
39+
</configuration>
40+
</plugin>
41+
42+
<plugin>
43+
<artifactId>maven-compiler-plugin</artifactId>
44+
<configuration>
45+
<compilerArgs>
46+
<arg>--add-exports</arg>
47+
<arg>org.graalvm.truffle/com.oracle.truffle.api.dsl=ALL-UNNAMED</arg>
48+
<compilerArgument>-proc:none</compilerArgument>
49+
</compilerArgs>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</build>
54+
55+
</project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// Copyright (C) 2005-2024, AdaCore
3+
// SPDX-License-Identifier: GPL-3.0-or-later
4+
//
5+
6+
package com.adacore.lkql_jit.annotations;
7+
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Target;
10+
11+
/**
12+
* Annotation to add a new built-in function to LKQL. Those annotations are automatically processed
13+
* by the BuiltInProcessor Java processor.
14+
*/
15+
@Target(ElementType.TYPE)
16+
public @interface BuiltInFunction {
17+
18+
/** Name for this built-in function */
19+
String name();
20+
21+
/** Documentation for this built-in function */
22+
String doc();
23+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// Copyright (C) 2005-2024, AdaCore
3+
// SPDX-License-Identifier: GPL-3.0-or-later
4+
//
5+
6+
package com.adacore.lkql_jit.annotations;
7+
8+
import java.lang.annotation.*;
9+
10+
/**
11+
* Annotation to add a new built-in method to LKQL. Those annotations are automatically processed by
12+
* the BuiltInProcessor Java processor.
13+
*/
14+
@Target(ElementType.TYPE)
15+
public @interface BuiltInMethod {
16+
17+
/** Name for this built-in method. */
18+
String name() default "";
19+
20+
/** Documentation for this built-in method. */
21+
String doc() default "";
22+
23+
/**
24+
* Types that this method should be added onto. Note that if the final computed set is empty,
25+
* method will be added on all types.
26+
*/
27+
String[] targetTypes() default {};
28+
29+
/**
30+
* Whether method is a property. A property is a built-in method that doesn't need any
31+
* arguments, and that doesn't take parens when you call it.
32+
*/
33+
boolean isProperty() default false;
34+
}

0 commit comments

Comments
 (0)