Hi there,

Few people here know me (Hi, Ralf !) so I owe you a few words about who I
am and what I do:

I'm a PhD candidate at University of Wrocław. My field of interest are
operating systems, computer architectures, compilers and programming
languages. I've been working with Waldek on FriCAS compiler for some time.
We regularly meet to discuss compiler's internals, SPAD language semantics
and various problems while I progress with my PhD.

A few months ago I finished a prototype of new compiler's backend. So far I
managed to generate optimized code for some functions using LLVM framework.
It's worth to mention that I don't need Common Lisp compiler / runtime to
run SPAD code! That was our the goal from the beginning and it's been
partially met. I stopped at the point where some type information was
missing from the code produced by SPAD compiler, effectively restraining us
from performing important optimizations and going any further. Also...
small part of runtime environment was implemented. We decided to use Boehm
GC as garbage collector. You can browse the code at
https://github.com/cahirwpz/phd/tree/master/spadil.

Here kicks in the motivation for the proposal... To finish my compiler I
need more type information from SPAD compiler. It's nearly impossible
(well... highly impractical) to achieve this with current implementation.
The type checker does not need to know all types to assume that a piece of
code will get compiled correctly. Moreover somewhere during code lowering
the type information is simply thrown away. I managed to recover some of
it, but not all. SPAD compiler is written in obscure and typeless language
(BOOT - fuuuuuu!) built on top of Common Lisp. Fixing the compiler is too
risky - the scope of changes is too difficult to predict, code is very
fragile with many subtle bugs lurking to reappear. So...

I'd like to write new type checker from scratch. Not only would it,
eventually, enable me to continue my work with code generator, but will
create opportunity to eliminate well known bugs, formalize the type system,
produce nicer diagnostic messages (I bet no one here likes reading
s-expressions from the parser!), make some type annotations unnecessary,
introduce new language tools (catch up with Aldor?). In fact I've already
begun the work. I'm still learning SPAD and currently I'm trying to build
some basic tools that I'll use to implement new type checker.
https://github.com/cahirwpz/phd/blob/master/stypechk.spad

The plan is to enter GSoC with all necessary tools ready to be used,
including:
a) abstract syntax tree representation,
b) generic AST walkers,
c) interface to global database of function signatures (daase)
d) compilation context / environment representation,
e) interface to call current compiler,
f) pretty printers,
g) ... and some simple tree rewriting examples (that will end up being a
part of new type checker).
Note that new type checker will be implemented exclusively in SPAD!

Phase no.1: 19th of May till 27th of June. Within 5 weeks I can manage to
build an unoptimized bottom-up type checker that will support most of
non-problematic language constructs. Without talking to Waldek I cannot
tell what's exactly going to be skipped.

In this phase new type checker will annotate the code with "$" and "@"
operators and feed it back to SPAD compiler. The goal is to catch certain
errors in algebra sources not detected by current type checker, make
compilation process faster, make certain type annotations obsolete.

Phase no.2: Up to around 18th of August. Handle previously skipped language
constructs. Optimize signature lookups (e.g. by environment trimming) and
other performance critical functions. Testing, more testing, even more
testing... Implement experimental type system extensions (if time allows).

That's my idea so far. I'll meet Waldek next week to polish it up before I
formally apply for GSoC. Any questions / ideas ?

-- 
Kind regards
Krystian Bacławski

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to