sd:sdcc
This is an old revision of the document!
SD/CC
SD/CC TinyC for the SD-8516
Introduction
A self-hosted C compiler has been on the table for quite some time. A few weeks ago I was able to get something set up where it could compile:
int main(void) { return 0; }
The problem was that isn't very much. So I looked at the BASIC expression parser and was trying to figure out how to get expressions. It's a recursive descent parser so the fist thing I added was additive and multiplicative expressions:
cc_parse_expr:
; Parse left operand
CALL @cc_parse_term
; Check error
LDAL [@CC_ERROR]
CMP AL, #0
JNZ @cc_pe_done
cc_pe_loop:
; Check for '+' or '-'
LDAL [@CC_TOKEN_TYPE]
CMP AL, TOK_PLUS
JZ @cc_pe_add
CMP AL, TOK_MINUS
JZ @cc_pe_sub
This kind of works, we can return 3+5 now; but I need more. I've been trying to get a symbol table up and to define int; but it isn't working.
More to come.
sd/sdcc.1776101590.txt.gz · Last modified: by appledog
