-
- Downloads
Begin functions (mathematical applications) implementation
The idea is to define functions this way `` let f : X -> Y, x -> y; `` where y is an expression of x and previously defined variables. - x is local to the function! - y cannot change *any* of its parameters (neither x or previously defined data) These will not be C/C++-like functions (which will be referred as routines) In this commit X and Y are basic types such as N, Z, R, B and string are allowed. The aim is to allow constructions like this, for instance: `` // definition let norm : R*R -> R, (x,y) -> sqrt(x*x + y*y); // usage R n = norm(2,3.2); `` Standard functions such as sin, cos, sqrt, abs, ... should be predefined functions of that kind. This commit only defines the simplest grammar. Definition is checked but use is still invalid (since function definition is not stored correctly according with regard to the function variable)
Showing
- src/language/ASTBuilder.cpp 57 additions, 54 deletionssrc/language/ASTBuilder.cpp
- src/language/ASTNodeDataType.cpp 3 additions, 0 deletionssrc/language/ASTNodeDataType.cpp
- src/language/ASTNodeDataType.hpp 1 addition, 0 deletionssrc/language/ASTNodeDataType.hpp
- src/language/ASTNodeDataTypeBuilder.cpp 42 additions, 0 deletionssrc/language/ASTNodeDataTypeBuilder.cpp
- src/language/ASTNodeExpressionBuilder.cpp 5 additions, 0 deletionssrc/language/ASTNodeExpressionBuilder.cpp
- src/language/ASTSymbolInitializationChecker.cpp 14 additions, 0 deletionssrc/language/ASTSymbolInitializationChecker.cpp
- src/language/ASTSymbolTableBuilder.cpp 16 additions, 0 deletionssrc/language/ASTSymbolTableBuilder.cpp
- src/language/PEGGrammar.hpp 26 additions, 7 deletionssrc/language/PEGGrammar.hpp
- src/language/PugsParser.cpp 1 addition, 1 deletionsrc/language/PugsParser.cpp
Loading
Please register or sign in to comment