Skip to content
Snippets Groups Projects
Commit 9820eaf8 authored by Julien Lopez's avatar Julien Lopez
Browse files

Code and documentation cleanup

parent b87d2eb3
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 31 deletions
......@@ -6,7 +6,11 @@ import qir.ast.QIRNode;
import qir.runtime.QIRContext;
import qir.util.QIRException;
@TruffleLanguage.Registration(name = "SL", version = "0.12", mimeType = QIRLanguage.MIME_TYPE)
/**
* QIR (Query Intermediate Language) is a language that aims to be able to encode any query from any
* language or database.
*/
@TruffleLanguage.Registration(name = "QIR", version = "0.20", mimeType = QIRLanguage.MIME_TYPE)
public final class QIRLanguage extends TruffleLanguage<QIRContext> {
public static final String MIME_TYPE = "application/x-qir";
......
......@@ -10,8 +10,8 @@ import qir.util.QIRAny;
import qir.util.QIRException;
/**
* The {@link QIRApply} represents an application of a {@link QIRLambda} or a {@link QIRTruffleNode}
* to a {@link QIRNode}, the latter being the value used for the substitution of the variable of the
* {@link QIRApply} represents an application of a {@link QIRLambda} or a {@link QIRTruffleNode} to
* a {@link QIRNode}, the latter being the value used for the substitution of the variable of the
* function.
*/
public final class QIRApply extends QIRNode {
......
......@@ -8,8 +8,8 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* This class represents a QIR expression that should be executed in a database using the driver
* {@link QIRDBNode#driver}.
* {@link QIRDBNode} represents a QIR expression that should be executed in a database using the
* driver {@link QIRDBNode#driver}.
*
* @param <DBRepr> The type of representation of a query for the database.
* @param <ConnData> The type of the configuration data to connect to the database.
......
......@@ -6,7 +6,13 @@ import com.oracle.truffle.api.source.SourceSection;
import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
public class QIRExternal extends QIRNode {
/**
* {@link QIRExternal} represents an external resource, for example an external function.
*/
public final class QIRExternal extends QIRNode {
/**
* The name of the external resource.
*/
public final String name;
public QIRExternal(SourceSection sourceSection, String name) {
......
......@@ -9,7 +9,7 @@ import qir.util.QIRAny;
import qir.util.QIRException;
/**
* The {@link QIRIf} represents a conditional expression.
* {@link QIRIf} represents a conditional expression.
*/
public final class QIRIf extends QIRNode {
/**
......
......@@ -11,7 +11,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* The {@link QIRLambda} represents a function with one argument.
* {@link QIRLambda} represents a function with one argument.
*/
public final class QIRLambda extends QIRNode {
/**
......@@ -27,6 +27,9 @@ public final class QIRLambda extends QIRNode {
*/
@Child public QIRNode body;
public final RootCallTarget target;
/**
* The environment of the function.
*/
public MaterializedFrame env;
public QIRLambda(final SourceSection source, final String funName, final QIRVariable var, final QIRNode body, final FrameDescriptor frameDescr) {
......
......@@ -7,8 +7,10 @@ import com.oracle.truffle.api.nodes.RootNode;
import qir.QIRLanguage;
/**
* The root of all QIR execution trees.
*/
public class QIRRootNode extends RootNode {
@Child public QIRNode body;
private final FrameSlot param;
......
......@@ -8,11 +8,17 @@ import qir.util.QIRAny;
import qir.util.QIRException;
/**
* This class represents an expression from the Truffle language named
* {@link QIRTruffleNode} represents an expression from the Truffle language named
* {@link QIRTruffleNode#languageName}.
*/
public final class QIRTruffleNode extends QIRNode {
/**
* The name of the Truffle language this expression comes from.
*/
public final String languageName;
/**
* The expression itself, encoded as a String for now.
*/
public final String code;
public QIRTruffleNode(final SourceSection source, final String languageName, final String code) {
......
......@@ -12,7 +12,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
import qir.util.QIRException;
class QIRResolvedLocalVariableNode extends QIRNode {
final class QIRResolvedLocalVariableNode extends QIRNode {
private final FrameSlot slot;
QIRResolvedLocalVariableNode(final SourceSection src, final FrameSlot slot) {
......@@ -44,7 +44,7 @@ class QIRResolvedLocalVariableNode extends QIRNode {
}
}
class QIRResolvedScopedVariableNode extends QIRNode {
final class QIRResolvedScopedVariableNode extends QIRNode {
public final String id;
private FrameSlot slot;
......@@ -87,7 +87,7 @@ class QIRResolvedScopedVariableNode extends QIRNode {
}
/**
* The {@link QIRVariable} represents a variable in the QIR tree. TODO: Fuse two nodes using depth.
* {@link QIRVariable} represents a variable in the QIR tree. TODO: Fuse two nodes using depth.
* TODO: Third case, frame == oldFrame -> use cached frameSlot
*/
public class QIRVariable extends QIRNode {
......
......@@ -8,7 +8,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* The {@link QIRLcons} represents a non-empty {@link QIRList}.
* {@link QIRLcons} represents a non-empty {@link QIRList}.
*/
public final class QIRLcons extends QIRList {
/**
......
......@@ -12,7 +12,7 @@ import qir.util.QIRAny;
import qir.util.QIRException;
/**
* The {@link QIRLdestr} represents an access to a value in a {@link QIRList}.
* {@link QIRLdestr} represents an access to a value in a {@link QIRList}.
*/
public final class QIRLdestr extends QIRNode {
/**
......
......@@ -6,7 +6,7 @@ import qir.ast.QIRNode;
import qir.driver.IQIRVisitor;
/**
* The {@link QIRList} is the generic representation of a list in QIR.
* {@link QIRList} is the generic representation of a list in QIR.
*/
public abstract class QIRList extends QIRNode {
public QIRList(final SourceSection source) {
......
......@@ -7,7 +7,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* This class represents the empty {@link QIRList}, it is therefore a singleton.
* {@link QIRLnil} represents the empty {@link QIRList}, it is therefore a singleton.
*/
public final class QIRLnil extends QIRList {
private QIRLnil() {
......
......@@ -8,13 +8,9 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* The {@link QIRTable} is the representation of a table of a database in QIR.
*
* @param <DBRepr> The type of representation of a query for the database.
* @param <ConnData> The type of representation of the configuration data to connect to the targeted
* database.
* {@link QIRTable} is the representation of a database table in QIR.
*/
public final class QIRTable<DBRepr, ConnData> extends QIRNode {
public final class QIRTable extends QIRNode {
/**
* The name of the table.
*/
......@@ -51,8 +47,8 @@ public final class QIRTable<DBRepr, ConnData> extends QIRNode {
return true;
if (!(other instanceof QIRTable))
return false;
return tableName.equals(((QIRTable<?, ?>) other).tableName) && dbName.equals(((QIRTable<?, ?>) other).dbName) && configFile.equals(((QIRTable<?, ?>) other).configFile) &&
schemaName.equals(((QIRTable<?, ?>) other).schemaName);
return tableName.equals(((QIRTable) other).tableName) && dbName.equals(((QIRTable) other).dbName) && configFile.equals(((QIRTable) other).configFile) &&
schemaName.equals(((QIRTable) other).schemaName);
}
@Override
......
......@@ -8,7 +8,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* The {@link QIRTcons} represents a non-empty {@link QIRTuple}.
* {@link QIRTcons} represents a non-empty {@link QIRTuple}.
*/
public final class QIRTcons extends QIRTuple {
/**
......
......@@ -10,7 +10,7 @@ import qir.util.QIRAny;
import qir.util.QIRException;
/**
* The {@link QIRTdestr} represents an access to a field in a {@link QIRTuple}.
* {@link QIRTdestr} represents an access to a field in a {@link QIRTuple}.
*/
public final class QIRTdestr extends QIRNode {
/**
......
......@@ -7,7 +7,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* This class represents the empty {@link QIRTuple}, it is therefore a singleton.
* {@link QIRTnil} represents the empty {@link QIRTuple}, it is therefore a singleton.
*/
public final class QIRTnil extends QIRTuple {
private QIRTnil() {
......
......@@ -6,7 +6,7 @@ import qir.ast.QIRNode;
import qir.driver.IQIRVisitor;
/**
* The {@link QIRTuple} is the generic representation of a tuple in QIR.
* {@link QIRTuple} is the generic representation of a tuple in QIR.
*/
public abstract class QIRTuple extends QIRNode {
public QIRTuple(final SourceSection source) {
......
......@@ -6,7 +6,7 @@ import com.oracle.truffle.api.source.SourceSection;
import qir.ast.QIRNode;
/**
* A basic QIR value of type BaseType.
* {@link QIRBaseValue} is a basic QIR value of type BaseType.
*
* @param <BaseType> The type of the value.
*/
......
......@@ -8,7 +8,7 @@ import qir.driver.IQIRVisitor;
import qir.util.QIRAny;
/**
* The {@link QIRBigNumber} represents an integer that can be represented as a BigInteger.
* {@link QIRBigNumber} represents a number that can be represented as a BigInteger.
*/
public final class QIRBigNumber extends QIRBaseValue<BigInteger> {
public QIRBigNumber(final SourceSection source, final BigInteger value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment