83 brief:
"Top level AST base class"
85 Ast
is a top level, abstract base
class defining the interface
86 for all nodes of Abstract Syntax Tree (AST).
91 brief:
"Base class for all AST node"
93 Base
class for all nodes in the AST. This can replace ast::Ast
in
99 brief:
"Base class for all expressions in the NMODL"
101 Base
class for all expression types. This
is one of the top level node
102 in the AST representing higher level expression constructs. %Expressions
103 can be a variable itself
or complex binary expressions.
112 brief:
"Value of string"
114 brief:
"Represents a string"
116 All statements encapsulating text block are stored
in the AST
as ast::String.
117 For example, nodes like ast::LineComment
and ast::Verbatim block use ast::String::value
118 to store the underlying text:
122 This text
is stored
as String
132 brief:
"Base class for all numbers"
134 Base
class for all number types like ast::Integer, ast::Float
and ast::Double.
141 brief:
"Value of integer"
144 brief:
"if integer is a macro then it's name"
147 brief:
"Represents an integer variable"
149 Non floating value
in the mod file
is parsed
as an integer. For example,
150 in the below code, integer literals like `0`
and `11` are stored
as ast::Integer
159 \sa ast::Float ast::Double
164 brief:
"Value of float"
166 brief:
"Represents a float variable"
168 Single precision float value
in the mod file can be represented by ast::Float.
170 \note Currently every float variable
in the NMODL
is stored
as ast::Double
and hence
171 this type
is note used. This will be changed soon
for variables like ast::ParamAssign.
173 \sa ast::Integer ast::Double
178 brief:
"Value of double"
180 brief:
"Represents a double variable"
182 %Double precision float value
in the mod file
is represented by ast::Double.
183 For example, float literals like `0.1`
in the mod file are parsed
as double
184 and stored using ast::Double::value :
193 Note that the variables are
not classified ast integer
or float
in the AST. The
194 decision about variable types
is done by code generation backends.
196 \sa ast::Integer ast::Float
201 brief:
"Value of boolean"
203 brief:
"Represents a boolean variable"
205 %Boolean values
in the mod file can be represented by ast::Boolean.
207 \note Currently this type
is used
as only flag
in some of the AST nodes. Similar to ast::Float,
208 this type was introduced
for data type specific code generation support
in the future.
211 brief:
"Base class for all identifiers"
213 Base
class for all variable types like ast::Name, ast::PrimeName
and ast::Argument.
222 brief:
"Value of name"
225 brief:
"Represents a name"
227 Whenever lexer encounters string variable, it returns a ast::Name
228 type. So, along
with ast::Integer, ast::Double ast::String
and ast::PrimeName,
229 ast::Name
is one of the fundamental type
in the AST. Many other variable types
230 (e.g. ast::GlobalVar, ast::RangeVar) have underlying value stored
as ast::Name.
232 \note This node should be able to use std::string
as value type instead of ast::String
237 brief:
"Name of prime variable"
241 brief:
"order of ODE"
243 brief:
"Represents a prime variable (for ODE)"
245 In case of ODE specification, all state variables appearing on LHS
246 with \`
as suffix are parsed by lexer
as ast::PrimeName. For example,
247 in below NMODL construct, m\`
is stored
as ast::PrimeName
with `m`
as a
248 ast::PrimeName::value
and `1`
as an ast::PrimeName::order.
259 brief:
"Name of array variable"
263 brief:
"length of an array or index position"
267 brief:
"Represents specific element of an array variable"
269 If variable
is declared
as an array
or when array element
is accessed,
270 it
is stored
in the ast
as ast::IndexedName. For example,
in below NMODL,
271 construct `m[4]`
is stored
as ast::IndexedName
with `m`
as ast::IndexedName::name
272 and `4`
as ast::IndexedName::length.
283 brief:
"Name of variable"
287 brief:
"Value specified with `@`"
292 brief:
"index value in case of array"
297 brief:
"Represents a variable"
299 This type was introduced to store variables of different types like
300 ast::Name
or ast::IndexedName
in the AST.
302 \note With ast::Identifier
as top level base
class, this type can be
303 removed
in the future refactoring.
308 brief:
"Name of the argument"
312 brief:
"Unit of the argument"
315 brief:
"Represents an argument to functions and procedures"
317 In case of function definitions
from different ast nodes like ast::FunctionBlock,
318 ast::ProcedureBlock, the arguments are store
in the ast::Argument. For example,
319 in below NMODL construct, `weight`
is stored
as ast::Argument::name
and `uS`
is
320 stored
as ast::Argument::unit:
323 NET_RECEIVE(weight (uS)) {
398 brief:
"Single variable of type RANDOM. pointer to a nrnran123_State"
401 brief:
"Name of the a RANDOM variable"
408 brief:
"Variable name"
411 brief:
"Represent a single variable of type BBCOREPOINTER"
413 See ast::BbcorePointer
for an example.
424 brief:
"Base class for all block scoped nodes"
426 NMODL has different local
and globals block scoped nodes like
427 ast::NeuronBlock, ast::ParamBlock, ast::IfStatement etc. Ast::Block
428 is base
class and defines common interface
for these nodes.
436 brief:
"Vector of parameters"
439 brief:
"Represents a `PARAMETER` block in the NMODL"
441 Variables whose values are normally specified by the user are parameters
442 and are declared
in a `PARAMETER` block. Here
is an example :
446 gkbar=.01 (mho/cm2) : Maximum Permeability
454 All parameters are stored
in the ast::ParamBlock::statements
as vector.
457 nmodl:
"INDEPENDENT "
460 brief:
"List of variable that should be independent"
464 brief:
"Represents a `INDEPENDENT` block in the NMODL"
466 `INDEPENDENT` has following form
in the NMODL specification :
470 t FROM 0 TO 1 WITH 1 (ms)
478 brief:
"Vector of assigned variables"
479 type: AssignedDefinition
482 brief:
"Represents a `ASSIGNED` block in the NMODL"
484 The `ASSIGNED` block
is used
for declaring two kinds of variables :
485 - those that are given values outside the mod files
486 - those that appear on the left hand side of assignment statements within
489 Below
is an example of `ASSIGNED` block
in the mod file:
504 brief:
"Vector of state variables"
505 type: AssignedDefinition
507 brief:
"Represents a `STATE` block in the NMODL"
509 If a model involves differential equations, families of algebraic equations,
510 or kinetic reaction schemes, their dependent variables
or unknowns are to be
511 listed
in the `STATE` block. Below
is an example of `STATE`:
520 Note that the state variable specification has form of ast::AssignedDefinition
and
521 hence can have associated unit specification.
527 brief:
"Block with statements vector"
529 getter: {override: true}
530 brief:
"Represents a `INITIAL` block in the NMODL"
532 The code
in the `INITIAL` block
is executed when the hoc function `
finitialize()`
533 is called. Here
is an example :
540 tadj = q10^((celsius - temp)/10)
545 nmodl:
"CONSTRUCTOR "
548 brief:
"Block with statements vector"
550 getter: {override: true}
551 brief:
"Represents a `CONSTRUCTOR` block in the NMODL"
553 The code
in the `CONSTRUCTOR`
is called when the channel
is instantiated. Like any
554 other
global block, `CONSTRUCTOR` block can have any statements. It often used
with
555 `VERBATIM` block
for initialization purpose :
565 \sa ast::DestructorBlock
571 brief:
"Block with statements vector"
573 getter: {override: true}
574 brief:
"Represents a `DESTRUCTOR` block in the NMODL"
576 The code
in the `DESTRUCTOR`
is called when the channel instance
is deleted. It often
577 used
with `VERBATIM` block
for finalization purpose :
590 \sa ast::ConstructorBlock
595 brief:
"Vector of statements"
599 brief:
"Represents block encapsulating list of statements"
601 Statement block
is used to hold list of statements between `{ }`. This
602 represents a new block scope
in the mod file
and has following form :
613 Note that the statement blocks can be nested where inner block will
614 be wrapped
as statement
with ast::ExpressionStatement.
620 brief:
"Name of the derivative block"
625 brief:
"Block with statements vector"
627 getter: {override: true}
628 brief:
"Represents `DERIVATIVE` block in the NMODL"
630 This block
is used to assign values to the derivatives of those
631 `STATE`s that are described by differential equations. The statements
632 in this block are of the form \f$y
' = expr\f$. Here is an example :
646 brief:
"Name of the linear block"
655 prefix: {value:
" SOLVEFOR "}
657 brief:
"Block with statements vector"
659 getter: {override: true}
660 brief:
"Represents `LINEAR` block in the NMODL"
663 A set of simultaneous equations can be specified
in a `LINEAR` block.
671 ~ vi = v + fac*vo - fac*v
672 ~ t2*vo - t2*vo0 + vo = -gain * e
673 ~ -stim - e + vi - e + t1*vi - t1*e - t1*(vi0 - e0) = 0
681 brief:
"Name of the non-linear block"
685 brief:
"Name of the integration method"
689 prefix: {value:
" SOLVEFOR "}
690 suffix: {value:
" ", force: true}
692 brief:
"Block with statements vector"
694 getter: {override: true}
695 brief:
"Represents `NONLINEAR` block in the NMODL"
698 A set of simultaneous equations can be specified
in a `NONLINEAR` block.
714 brief:
"Name of the discrete block"
719 brief:
"Block with statements vector"
721 getter: {override: true}
723 - FunctionTableBlock:
725 nmodl:
"FUNCTION_TABLE "
728 brief:
"Name of the function table block"
732 brief:
"Vector of the parameters"
735 prefix: {value:
"(", force: true}
736 suffix: {value:
")", force: true}
738 getter: {override: true}
740 brief:
"Unit if specified"
750 brief:
"Name of the function"
754 brief:
"Vector of the parameters"
757 prefix: {value:
"(", force: true}
758 suffix: {value:
")", force: true}
760 getter: {override: true}
762 brief:
"Unit if specified"
766 suffix: {value:
" ", force: true}
768 brief:
"Block with statements vector"
770 getter: {override: true}
777 brief:
"Name of the procedure"
781 brief:
"Vector of the parameters"
784 prefix: {value:
"(", force: true}
785 suffix: {value:
") ", force: true}
787 getter: {override: true}
789 brief:
"Unit if specified"
793 brief:
"Block with statements vector"
795 getter: {override: true}
799 nmodl:
"NET_RECEIVE "
802 brief:
"Parameters to the net receive block"
805 prefix: {value:
"(", force: true}
806 suffix: {value:
") ", force: true}
808 getter: {override: true}
810 brief:
"Block with statements vector"
812 getter: {override: true}
819 brief:
"Name of the block to solve"
823 brief:
"Name of the integration method"
826 prefix: {value:
" METHOD "}
828 brief:
"Name of the integration method"
831 prefix: {value:
" STEADYSTATE "}
837 brief:
"Block with statements vector"
839 getter: {override: true}
840 brief:
"Represents a `BREAKPOINT` block in NMODL"
842 The `BREAKPOINT` block
is used to update current
and conductance.
843 at each time step. Here
is an example of `BREAKPOINT` :
847 SOLVE states METHOD cnexp
856 \sa ast::DerivativeBlock ast::InitialBlock
862 brief:
"Block to be called before"
864 brief:
"Represents a `BEFORE` block in NMODL"
870 brief:
"Block to be called after"
872 brief:
"Represents a `AFTER` block in NMODL"
874 This represents a block to be executed before another block.
875 Here
is an example of `BEFORE` :
891 brief:
"Type of NMODL block"
895 brief:
"Block with statements vector"
897 getter: {override: true}
898 brief:
"Represents a block to be executed before or after another block"
900 This represents a block to be executed before
or after another
901 block
in NMODL. See ast::BeforeBlock
and ast::AfterBlock
for usage.
905 nmodl:
"FOR_NETCONS "
908 brief:
"Arguments to the for netcon block"
911 prefix: {value:
"(", force: true}
912 suffix: {value:
") ", force: true}
914 getter: {override: true}
916 brief:
"Block with statements vector"
918 getter: {override: true}
925 brief:
"Name of the kinetic block"
930 brief:
"Solve for specification (TODO)"
935 brief:
"Block with statements vector"
937 getter: {override: true}
944 brief:
"Vector of unit statements"
952 brief:
"Vector of constant statements"
953 type: ConstantStatement
955 brief:
"Represent `CONSTANT` block in the mod file"
957 Here
is an example of `CONSTANT` block
in mod file:
973 brief:
"Block with statements vector"
975 getter: {override: true}
976 brief:
"Represent `NEURON` block in the mod file"
978 The keyword `NEURON` introduces a special block which contains statements
979 that tell NMODL how to organize the variables
for access at the NEURON user
980 level. Here
is an example of `NEURON` block
from `HH` channel:
985 USEION na READ ena WRITE ina
986 USEION k READ ek WRITE ik
987 NONSPECIFIC_CURRENT il
988 RANGE gnabar, gkbar, gl, el, gna, gk
989 RANGE minf, hinf, ninf, mtau, htau, ntau
994 url:
"https://www.neuron.yale.edu/neuron/static/py_doc/modelspec/programmatic/mechanisms/nmodl2.html#neuron"
1003 prefix: {value:
"("}
1004 suffix: {value:
")"}
1031 prefix: {value:
"<"}
1032 suffix: {value:
","}
1036 suffix: {value:
">"}
1044 prefix: {value:
"<"}
1045 suffix: {value:
","}
1049 suffix: {value:
">"}
1054 brief:
"Name of the variable"
1058 brief:
"Value of the constant"
1060 prefix: {value:
" = "}
1062 brief:
"Unit for the variable"
1065 prefix: {value:
" "}
1066 brief:
"Represents a variable in the ast::ConstantBlock"
1073 brief:
"Operator used in ast::BinaryExpression"
1095 prefix: {value:
"("}
1096 suffix: {value:
")"}
1101 brief:
"LHS of the binary expression"
1105 type: BinaryOperator
1107 brief:
"RHS of the binary expression"
1109 brief:
"Represents binary expression in the NMODL"
1111 Any binary expression
in the mod file
is represented by this node type.
1112 For example,
in below example, there are three binary expressions :
1116 SOLVE states METHOD cnexp
1121 Note that the statement itself
is stored
in another type ast::ExpressionStatement.
1123 \sa ast::ExpressionStatement
1126 brief:
"Represents differential equation in DERIVATIVE block"
1129 brief:
"Differential Expression"
1130 type: BinaryExpression
1143 brief:
"One equation in a system of equations that collectively make a NONLINEAR block."
1147 brief:
"Left-hand-side of the equation."
1149 suffix: {value:
" = "}
1151 brief:
"Right-hand-side of the equation."
1155 brief:
"One equation in a system of equations tha collectively form a LINEAR block."
1159 brief:
"Left-hand-side of the equation."
1161 suffix: {value:
" = "}
1163 brief:
"Right-hand-side of the equation."
1178 prefix: {value:
"(", force: true}
1179 suffix: {value:
")", force: true}
1187 prefix: {value:
"("}
1188 suffix: {value:
")"}
1192 prefix: {value:
" "}
1199 brief:
"Type to represent different block types for before/after block"
1201 Different NMODL blocks can be used
with ast::BeforeBlock
and ast::AfterBlock.
1202 This type
is used to represent such block types.
1204 \sa ast::BeforeBlock
as::AfterBlock
1215 prefix: {value:
" = "}
1223 suffix: {value:
" ="}
1228 prefix: {value:
" "}
1232 prefix: {value:
" "}
1234 brief:
"Todo: Michael : rename variable gt as well"
1242 prefix: {value:
" "}
1249 prefix: {value:
" "}
1250 suffix: {value:
" "}
1265 - LocalListStatement:
1288 brief:
"Name of the macro"
1292 brief:
"Value of the macro"
1294 prefix: {value:
" "}
1295 brief:
"Represents a `DEFINE` statement in NMODL"
1298 brief:
"Represents an `INCLUDE` statement in NMODL"
1302 brief:
"path to the file to include"
1305 brief:
"AST of the included file"
1320 prefix: {value:
" = "}
1325 prefix: {value:
" "}
1330 prefix: {value:
" "}
1332 - AssignedDefinition:
1335 brief:
"Name of the variable"
1339 brief:
"Length in case of array"
1342 prefix: {value:
"["}
1343 suffix: {value:
"]"}
1347 prefix: {value:
" FROM "}
1352 prefix: {value:
" TO "}
1357 prefix: {value:
" START "}
1363 prefix: {value:
" "}
1367 prefix: {value:
" <"}
1368 suffix: {value:
">"}
1370 brief:
"Represents a statement in `ASSIGNED` or `STATE` block"
1373 nmodl:
"CONDUCTANCE "
1376 brief:
"Conductance variable"
1382 prefix: {value:
" USEION "}
1383 brief:
"Represents `CONDUCTANCE` statement in NMODL"
1385 If `I/V` relation
in the `BREAKPOINT` block
is ohomic then one can
1386 specify `CONDUCTANCE` hint
for optimised code generation:
1389 CONDUCTANCE g USEION I
1392 \sa nmodl::visitor::SympyConductanceVisitor
1394 - ExpressionStatement:
1420 prefix: {value:
" = "}
1424 prefix: {value:
" TO "}
1428 prefix: {value:
" BY "}
1429 suffix: {value:
" ", force: true}
1433 type: StatementBlock
1434 getter: {override: true}
1443 prefix: {value:
"("}
1444 suffix: {value:
") "}
1447 type: StatementBlock
1448 getter: {override: true}
1457 prefix: {value:
"("}
1458 suffix: {value:
") "}
1461 type: StatementBlock
1462 getter: {override: true}
1465 type: ElseIfStatement
1479 prefix: {value:
"("}
1480 suffix: {value:
") "}
1483 type: StatementBlock
1484 getter: {override: true}
1492 type: StatementBlock
1493 getter: {override: true}
1499 brief:
"Vector of watch statements"
1504 brief:
"Represent WATCH statement in NMODL"
1508 brief:
"Represent MUTEXLOCK statement in NMODL"
1512 brief:
"Represent MUTEXUNLOCK statement in NMODL"
1520 prefix: {value:
" "}
1524 prefix: {value:
" = "}
1525 brief:
"Represent CONSERVE statement in NMODL"
1531 brief:
"Name of the index variable in volume expression"
1534 prefix: {value:
" "}
1535 suffix: {value:
","}
1537 brief:
"The volume of the compartment"
1539 prefix: {value:
" "}
1541 brief:
"The names of the species that reside in this compartment"
1544 prefix: {value:
" {"}
1545 suffix: {value:
"}"}
1547 brief:
"Represent COMPARTMENT statement in NMODL"
1550 nmodl: LONGITUDINAL_DIFFUSION
1553 brief:
"Index variable name"
1556 prefix: {value:
" "}
1557 suffix: {value:
","}
1559 brief:
"Diffusion coefficient/rate"
1561 prefix: {value:
" "}
1563 brief:
"Names of the diffusing species"
1566 prefix: {value:
" {"}
1567 suffix: {value:
"}"}
1569 brief:
"Represent LONGITUDINAL_DIFFUSION statement in NMODL"
1572 - ReactionStatement:
1581 type: ReactionOperator
1582 prefix: {value:
" "}
1586 prefix: {value:
" "}
1591 prefix: {value:
" ("}
1595 prefix: {value:
", "}
1596 suffix: {value:
")", force: true}
1603 brief:
"Name of the variable (TODO)"
1606 brief:
"Name of the variable (TODO)"
1608 prefix: {value:
" BY "}
1609 brief:
"Represents a LAG statement in the mod file"
1611 An example of LAG statement usage:
1617 if (ena < 70) {ena = 70}
1621 - ConstantStatement:
1624 brief:
"single constant variable"
1626 brief:
"Represent statement in CONSTANT block of NMODL"
1628 \todo As ConstantStatement wraps a single ConstantVar,
1629 this
or ast::ConstantVar can be redundant
in the future.
1635 brief:
"Variables in the table"
1640 brief:
"dependent variables"
1643 prefix: {value:
" DEPEND "}
1648 prefix: {value:
" FROM "}
1652 prefix: {value:
" TO "}
1654 brief:
"an increment factor"
1656 prefix: {value:
" WITH "}
1657 brief:
"Represents TABLE statement in NMODL"
1662 brief:
"type of channel"
1664 suffix: {value:
" "}
1666 brief:
"Name of the channel"
1669 brief:
"Represents SUFFIX statement in NMODL"
1675 brief:
"Name of ion"
1679 brief:
"Variables being read"
1682 prefix: {value:
" READ "}
1685 brief:
"Variables being written"
1688 prefix: {value:
" WRITE "}
1695 brief:
"Ontology to indicate the chemical ion"
1698 prefix: {value:
" REPRESENTS "}
1699 brief:
"Represents USEION statement in NMODL"
1702 nmodl:
"NONSPECIFIC_CURRENT "
1705 brief:
"Vector of non specific variables"
1706 type: NonspecificCurVar
1709 brief:
"Represents NONSPECIFIC_CURRENT variables statement in NMODL"
1712 nmodl:
"ELECTRODE_CURRENT "
1715 brief:
"Vector of electrode current variables"
1716 type: ElectrodeCurVar
1719 brief:
"Represents ELECTRODE_CURRENT variables statement in NMODL"
1725 brief:
"Vector of range variables"
1729 brief:
"Represents RANGE variables statement in NMODL"
1736 brief:
"Vector of global variables"
1741 brief:
"Represents GLOBAL statement in NMODL"
1744 brief:
"Represents RANDOM statement in NMODL"
1748 brief:
"Vector of random variables"
1753 Here
is an example of RANDOM statement
1758 POINT_PROCESS NetStim
1766 brief:
"Vector of pointer variables"
1771 brief:
"Represents POINTER statement in NMODL"
1774 nmodl:
"BBCOREPOINTER "
1777 brief:
"Vector of bbcore pointer variables"
1778 type: BbcorePointerVar
1781 brief:
"Represents BBCOREPOINTER statement in NMODL"
1783 Here
is an example of BBCOREPOINTER statement:
1788 POINT_PROCESS ProbAMPANMDA_EMS
1789 BBCOREPOINTER rng, data
1796 brief:
"Vector of external variables"
1800 brief:
"This construct is deprecated and no longer supported in the NMODL"
1804 brief:
"Represents THREADSAFE statement in NMODL"
1807 brief:
"Represents a C code block"
1811 brief:
"C code as a string"
1813 suffix: {value:
"ENDVERBATIM"}
1816 brief:
"Represents a one line comment in NMODL"
1819 brief:
"comment text"
1823 brief:
"Represents a multi-line comment in NMODL"
1827 brief:
"comment text"
1829 suffix: {value:
"ENDCOMMENT"}
1831 - OntologyStatement:
1832 nmodl:
"REPRESENTS "
1835 brief:
"Ontology name"
1837 brief:
"Represents CURIE information in NMODL"
1840 brief:
"Represents top level AST node for whole NMODL input"
1843 brief:
"Vector of top level blocks in the mod file"