Class CodeGenerator

java.lang.Object
com.github.gbenroscience.math.differentialcalculus.CodeGenerator

public class CodeGenerator extends Object
Objects of this class take the output of the semantic analyzer and uses it to generate code that the derivative engine can work with.
Author:
GBEMIRO
  • Constructor Details

  • Method Details

    • getScanner

      public ArrayList<String> getScanner()
    • simplifyTokens

      public static void simplifyTokens(ArrayList<String> scan)
      Coordinating method to generate math code almost ready for calculus.
      Parameters:
      scan - An ArrayList object containing math tokens.
    • openUpUnnecessaryBrackets

      public static void openUpUnnecessaryBrackets(ArrayList<String> scan)
      Open up unnecessary brackets..e.g. (5) or 3+(2-9+8+cos(4))-7*x..should become 3+2-9+8+cos(4)-7*x
      Parameters:
      scan - The scanner output.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)