Developer FAQ - axkr/symja_android_library GitHub Wiki
How can I interactively execute the Symja language?
- two REPLs are available in the library a Console.java for standard math input and a MMAConsole.java for Mathematica like syntax input.
Where can I find the documentation of built-in functions in the repository?
- you can find it in the /doc/functions folder
- the language documentation can be found in the /doc folder
Where are the built-in function implementations in Java?
- package org.matheclipse.core.builtin
- and package org.matheclipse.core.reflection.system contain the buit-in functions implementation
How can I define a new Symja built-in function name in Java?
- add the new name to AST2Expr.FUNCTION_STRINGS
- run the development tool FunctionIDGenerator and copy the generated source code to the file ID.java
- run the development tool BuiltinGenerator and replace the corresponding section with the generated source code in the file S.java
- if you like you can define Java "function stubs" for your function in the file F.java
- if you plan to implement a bunch of new built-in functions you can open an issue and we create the corresponding templates for you.
- here is an example commit #939f6de, #8d6594a for a simple
Beep()
function. - more tips how to integrating-your-own-java-library-with-the-wxf-format
Where are the main basic transformation rules defined?
- They are defined in the /rules folder and translated to Java code with the Rule-preprocessor
Where are the parsers defined?
- in package org.matheclipse.core.parser the main
ExprParser
class is implemented to transform an input string directly to anIExpr
object - the basic parser structures are defined in package org.matheclipse.parser.client this
Parser
can be used on the client side without the whole Symja stuff. Inside Symja theAST2Expr
class is used to transform the client sideASTNode
into anIExpr
. - all operators and their affix, associativity, and precedence are defined in the ASTNodeFactory class
- another "fuzzy parser" FuzzyParser.java is implemented for the parsing of JSON API input queries.
Where is the structural pattern-matching implemented?
- it's implemented in package org.matheclipse.core.patternmatching
- the "Rubi Integration" rules are implemented with structural pattern-matching. See: Porting Rubi Integration rules to Symja
Where are the main JUnit tests located?
- the class CompleteTestSuite starts the main JUnit test cases
- in class LowercaseTestCase you can find an example for almost all built-in functions.
- the "Rubi Integration" rules implementation has their own JUnit test classes. See: Porting Rubi Integration rules to Symja
How can I prepare an IDE to work on Symja source code?
- Select and install an IDE of your choice and create a new workspace for Symja.
- If you want to work with Eclipse the package
Eclipse IDE for Java Developers
provides everything you need. - If you prefer another Eclipse package make sure you have Eclipse JDT and the Eclipse Maven integration (m2e) installed.
- Clone the repository you want to work with to your computer and add it to your IDE.
- It is recommended to create a fork and clone your fork if you want to contribute to Symja, but it is also possible to clone this repository directly.
- If you are not yet familiar with the usual github work flow for contributions, consider to read this GitHub article.
- Import all Maven modules in your Symja clone to your IDE.
- In Eclipse it is recommended to do this via File -> Import... -> Git -> Projects from Git (with smart import) -> Click
Next
-> Existing local repository -> select your local Symja clone and clickNext
. -> Select all folders except for the root folder. - In Eclipse it is additionally recommended to enable automatic Maven project configuration via Window -> Preferences -> Maven -> Automatically update Maven project configuration (which is currently an experimental feature of m2e). Additionally you could consider to enable automatic download of artifact sources and java-doc. If you don't want to enable automatic project configuration update, you have to trigger the project configuration update manually via right click on the project -> Maven -> Update Project ...
What is the preferred Java code formatter?
-
The Google Java Formatter, which reformats Java source code to comply with Google Java Style, is used for formatting Java source codes.
-
Equivalent Google Java Style Formatter configurations for Eclipse and Intellij are also available and can be imported into the corresponding IDE.
- In Eclipse you can import the downloaded configuration via Window -> Preferences -> Java -> Code Style -> Formatter -> Click on
Import...
and select the downloaded configuration file.
- In Eclipse you can import the downloaded configuration via Window -> Preferences -> Java -> Code Style -> Formatter -> Click on
How can I build Symja locally on my computer?
-
On the command line run the following Maven command from the root of this git repository's local clone:
mvn clean verify -f symja_android_library
- In Eclipse you can just run the
symja--build
launch-configuration
- In Eclipse you can just run the
This compiles all Symja modules, executes all tests and builds all jars including runtime, source and java-doc jars.
How can the Maven dependencies be used with Gradle
- see for example ElasticSearch: https://stackoverflow.com/a/67210051/24819