Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Kalk Kalk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 9
    • Issues 9
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Plasma MobilePlasma Mobile
  • KalkKalk
  • Issues
  • #19
Closed
Open
Issue created Feb 22, 2021 by Han Young@hanyoungDeveloper

Decide the parser archteciture

Currently we have flex/bison to deal with the input. All the calculation are done with built-in double type. As many in KDE pointed out, use double for precise calculation is a mistake. To meet the standards of KDE review, we have to switch infinite-precision numeric type. Luckily, knumber class from KCalc can be re-used.

Now the problem is, KCalc takes one or two input and one operator, calculate the result and display it. Kalk keeps the user entered math expression and evaluation the expression on input. Thus, we have to construct a parse tree from expression. To incorporate knumber into Kalk. The easiest way is to let flex return string, and construct knumber from string in bison. Though totally acceptable for practical reasons, we pay the price of extra regex matching (one in flex and one in knumber constructor), which is undesirable.

The other solution is to drop flex, let UI side to notify the type of input element (operator or number). In this way we parse the operators ourselves.

The upcoming binary/programmer mode also needs to take into consideration. @arenagrenade What do you think about this?

Assignee
Assign to
Time tracking