Parser 1

From DaveWiki

Jump to: navigation, search

This is an introduction to the expression parser/compiler/VM including overall goals and notes.

Purpose

The original purpose of this project came from a simple data graphing application I created. It loads up a custom data file containing dozens of columns and sometimes millions of rows and displays the data in a variety of graphs. A very simple application but one that I use frequently to quickly review data.

The application started out as a straight data viewer, load the data and graph it, but as it progressed I began adding custom data channels at run time. The expressions used were relatively simple ones like:

  Roll = atan2(cos(AccX)/sin(AccY), AccZ)

which creates a new data column Roll from three existing channels in a file. More and more of these run time channels were added but the issue was it required the application to be modified, recompiled, and redistributed each time. What I would like to do is to be able to enter the expressions dynamically at run time so I won't have to modify the application whenever a new channel is required or an existing one modified. It also would let other people define their own expressions rather than having to ask me each time.

The rough goals for the project are:

  • Create a parser capable of computing simple expressions (operators, identifiers, and functions).
  • Use of a single data type (float or double).
  • Be capable of dynamically computing millions of rows of data at run time within a reasonable time.

Notes

A few important notes about the project and these walkthroughs:

  • The parser/VM being created is only a very basic and simple one. We are not trying to implement a Java level language/VM in a weekend.
  • Many of the design decisions have been along the lines of "quick and dirty" rather than actually, what is the word, "good". I'll try to point these out along the way.


Next Article: Parser_2

Personal tools