\documentclass[a4paper]{article}
\usepackage{url}
\usepackage{paralist}
\usepackage{textcomp}
\usepackage{multicol}
\usepackage{url}
\usepackage{lscape,longtable}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{colortbl}
\usepackage[latin1]{inputenc}
\usepackage{eurosym}



% a bit wider
\advance\evensidemargin-.5in
\advance\oddsidemargin-.5in
\advance\textwidth1in
% Vertical space mods from Mike's old 2.09 version.
% Separate paragraphs, and subvert \item to leave less space!
%
\parskip=0.5\baselineskip
\parindent=0pt



\newlength{\WMwd}
\newlength{\WMaddr}
\font\fa=cmcsc10  scaled 1440
\font\fb=cmss12   scaled 1095
\font\fc=cmss10   scaled 1000


\def\kopf{
 \settowidth{\WMwd}{\fa Dr.\ Olga Caprotti}
 \settowidth{\WMaddr}{\fc caprottio@acm.orgXXXXXX}
 \expandafter\ifx\csname fontsize\endcsname\relax\else
   \fontsize{12}{14.4pt}\selectfont
 \fi
 \vspace*{7truemm}
 %{\fc\hspace{.0em}}
 \parbox[t]{\WMwd}{{\fa Web4Math} \\
                   {\fb Dr.\ Olga Caprotti} \\
                   {\fc caprottio@acm.org} }
 \hfill
 \parbox[t]{\WMaddr}{\fc H.\"O. M\"ollersv\"ag 5 \\
                     \fc SE--24471 D\"osjebro \\
                     \fc voice: +46 46 772163}
\vspace*{2truemm}
\hrule
\vspace*{7truemm}
}

\pagestyle{headings}

\begin{document}

\begin{titlepage}
\vspace*{-2.5cm}%
\kopf


{\LARGE\bfseries{Maxima Parser}}

\parbox[t]{10cm}
{{\fb Tender}: \fc  FP6-LeAM/2004/004\\
 {\fb Project}: \fc LeActiveMath \\
 {\fb Date}: \fc \today \\
}



\vfill
  
\end{titlepage}
 
\date{Tender: 
  Project: LeActiveMath}
 
\newpage
\def\contentsname{\sffamily Contents}%
{\small\sffamily\tableofcontents\par}


\newpage

\normalsize

\section{Introduction }
\label{sec:intro}

This document is part of tender FP6-LeAM/2004/004 issued by the European FP6 project "LeActiveMath"
(IST-507826) concerning the development of the \emph{LeAM Phrasebook}, technically an OpenMath
interface to the computational software system Maxima. It describes the parser converting Maxima
internal representation to Openmath XML encoding. 

The parser is generated using ANTLR (ANother Tool for Language Recognition),
\url{http://www.antlr.org}. From the abstract syntax tree, a string representation of the XML
encoding of the corresponding OpenMath object is then constructed. 


\section{Maxima General Representation }
\label{sec:maximaGR}

The computer algebra system Maxima is a lisp based system in which alsmost every computational
object has an internal representation called Maxima general representation (GR) that requires
everything to be either an atom or of the form ((<symbol> <sexpr>...)  <GR>...).  Maxima uses some
non-GR representations, notably rational expressions and Poisson series, that are special-cased
throughout the system. 

The (still partial) definition of the grammar of the general representation is given in the ANTLR input file
\begin{verbatim}
sExpr    :   maximaGR
         ;

maximaGR : INT 
         | ID 
         | LISP_OP 
         | VAR   
         | maximaList
         ;

maximaList : LPAREN! maximaGR (maximaGR)* RPAREN!  
           | SHARP_QUOTE maximaGR
           ;
\end{verbatim}

*** Document where  it fails, different representations


\section{MaximaOMTreeWalker}
\label{sec:tree}

The class \texttt{MaximaOMTreeWalker} is responsible for converting the abstact syntax tree
representing the Maxima general representation to the OpenMath XML encoding. It is based on a
hastable recording the mapping used to map Maxima operators to OpenMath symbols. For instance the
hashtable associates Maxima's \texttt{MABS} to the symbol \texttt{abs} defined in the OpenMath CD
\texttt{arith1}.

The hashtable is currently hardcoded but we are considering a configuration option by which the user
may extend it via a file to be read as input during initialization.

Currently the output of the parser is a string representing the OpenMath object in XML encoding and
is independent of the RIACA Java Libraries.




\bibliographystyle{siam}
\bibliography{monet}

\end{document}

