# Implementation specific
target ONETEP
-Variable kinet = FortranVariable("kinet", spam3)
-Variable bra_basis = FortranVariable("bra_basis", func_basis)
-Variable bras_on_grid = FortranVariable("bras_on_grid", double(:))
-Variable ket_basis = FortranVariable("ket_basis", func_basis)
-Variable kets_on_grid = FortranVariable("kets_on_grid", double(:))
+Variable kinet = FortranVariable("kinet", "spam3")
+Variable bra_basis = FortranVariable("bra_basis", "func_basis")
+Variable bras_on_grid = FortranVariable("bras_on_grid", "double(:)")
+Variable ket_basis = FortranVariable("ket_basis", "func_basis")
+Variable kets_on_grid = FortranVariable("kets_on_grid", "double(:)")
Variable bra = PPDFunctionSet(bras_on_grid, bra_basis)
Variable ket = PPDFunctionSet(kets_on_grid, ket_basis)
-
-FortranFunction("integrals_kinetic", kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
+Variable output = FortranFunction("integrals_kinetic", kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
def comment : Parser[Comment] = "#"~!".*".r ^^ (v => new Comment(v._2))
def identifier : Parser[Identifier] = ident ^^ (v => new Identifier(v))
- def oflType : Parser[OFLType] = matrixType | functionSetType | indexType
- def matrixType : Parser[Matrix] = "Matrix" ^^ (_ => new Matrix)
+ def oflType : Parser[OFLType] = arrayType | functionSetType | indexType
+ def arrayType : Parser[Matrix] = "Array["~>repsep(indexType, ",")<~"]" ^^ (x => new Matrix(x))
def functionSetType : Parser[FunctionSet] = "FunctionSet" ^^ (_ => new FunctionSet)
- def indexType : Parser[Index] = "Index" ^^ (_ => new Index)
+ def indexType : Parser[Index] = "FunctionIndex" ^^ (_ => new Index)
def declarations: Parser[DeclarationList] = oflType~!repsep(identifier, ",") ^^
(d => new DeclarationList(d._1, d._2))
def operator : Parser[Operator] = identifier~("("~>repsep(expr, ",")<~")") ^^ (x => new Operator(x._1, x._2))
def target : Parser[Target] = "target"~!identifier ^^ (x => new Target(x._2))
- def specifics : Parser[TargetAssignment] = identifier~("is"~>functionCall) ^^ (x => new TargetAssignment(x._1, x._2))
+ def specifics : Parser[TargetAssignment] = "Variable"~>identifier~("="~>functionCall) ^^ (x => new TargetAssignment(x._1, x._2))
def functionCall : Parser[FunctionCall] = identifier~("("~>repsep(functionParameter, ",")<~")") ^^
(x => new FunctionCall(x._1, new ParameterList(x._2 : _*)))
- def functionParameter : Parser[Parameter] = stringParameter | numericParameter | parameterList
+ def functionParameter : Parser[Parameter] = stringParameter | numericParameter | identifier | parameterList
def stringParameter : Parser[StringParameter] = stringLiteral ^^ (x => new StringParameter(x.slice(1, x.length-1)))
def numericParameter : Parser[NumericParameter] = floatingPointNumber ^^ (x => new NumericParameter(x.toDouble))
def parameterList : Parser[ParameterList] = "["~>repsep(functionParameter, ",")<~"]" ^^ (x => new ParameterList(x : _*))
package ofc.parser
-case class Identifier(name: String) {
+case class Identifier(name: String) extends Parameter {
override def toString : String = "id(\""+name+"\")"
def getName = name
}
}
sealed abstract class OFLType
-case class Matrix() extends OFLType {
+case class Matrix(indices: List[Index]) extends OFLType {
override def toString : String = "Matrix"
}
case class FunctionSet() extends OFLType {