Replace lex-bison based parser with handwritten parser in gcalctool

Arth

Abstract

The aim of this application is to change current lex-bison based parser with the handwritten parser. As, handwritten parser are much faster and can be ported to other languages without much trouble, this will help in both, making gcalctool fast as well as portable.

Additional Information

Current math parser in gcalctool is based on lex-bison chain. This code is good enough for languages like C and C++. Due to lack of lex or bison ports in other higher level languages, It is hard to rewrite the code in higher level language. Converting the generated lex or bison code is a very tedious task and is pointless. 

My work will be mainly focused on creating a good hand-written parser and replace the current parser.. The major part of this process is focused on devising a faster algorithm, which will generate proper parse-tree in the least time possible.

My current idea is to device a 2 level mechanism like current lex and bison layer. Lex part of the code will do similar task as what currently is being done by lex. However parser part is being re-written from scratch for optimization, and might be a blend of LL(1), LR(1) and operator precedence parser..

Code samples