Skip to content

Commit

Permalink
Merge branch 'topic/declarative_builtins' into 'master'
Browse files Browse the repository at this point in the history
Implement a built-in registration system akin to TruffleRuby's

See merge request eng/libadalang/langkit-query-language!379
  • Loading branch information
raph-amiard committed Jan 20, 2025
2 parents 1030a84 + f86c013 commit 9069e57
Show file tree
Hide file tree
Showing 58 changed files with 2,114 additions and 2,527 deletions.
1 change: 1 addition & 0 deletions lkql_jit/.idea/codeStyles/Project.xml

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

55 changes: 55 additions & 0 deletions lkql_jit/builtins_annotations/pom.xml
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>
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();
}
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;
}
Loading

0 comments on commit 9069e57

Please sign in to comment.