sic

The sic programming language, compiler and tools (WIP)
Log | Files | Refs

TODO (2348B)



Lexer
---------------------
[x] comments / whitespace
[x] strings
[x] numbers
[x] identifiers 
[ ] multi-char operators
[ ] single-char operators
[ ] punctuation
[ ] errors
[ ] keywords upgrade from idents

Parser
---------------------
[ ] 1. Assignment              = += -= *= /= %= ...
[ ] 2. Ternary                 ? :
[ ] 3. Logical OR              ||
[ ] 4. Logical AND             &&
[ ] 5. Bitwise OR              |
[ ] 6. Bitwise XOR             ^
[ ] 7. Bitwise AND             &
[ ] 8. Equality                == !=
[ ] 9. Relational              < <= > >=
[ ] 10. Shift                  << >>
[ ] 11. Additive               + -
[ ] 12. Multiplicative          * / %
[ ] 13. Unary                   ! ~ - + * & ++ -- sizeof
[ ] 14. Postfix                 call(), index[], member., member->, postfix++, postfix--
[ ] 15. Primary                 literals, identifiers, parenthesized expressions

parseExpression()
    parseAssignment()

parseAssignment()
    parseTernary()
    if next is assignment operator:
        parseAssignment()      // right-associative

parseTernary()
    parseLogicalOr()
    if next is ?:
        parseExpression()
        expect :
        parseTernary()

parseLogicalOr()
    parseLogicalAnd()
    while next is ||:
        parseLogicalAnd()

parseLogicalAnd()
    parseBitwiseOr()
    while next is &&:
        parseBitwiseOr()

parseBitwiseOr()
    parseBitwiseXor()
    while next is |:
        parseBitwiseXor()

parseBitwiseXor()
    parseBitwiseAnd()
    while next is ^:
        parseBitwiseAnd()

parseBitwiseAnd()
    parseEquality()
    while next is &:
        parseEquality()

parseEquality()
    parseRelational()
    while next is == or !=:
        parseRelational()

parseRelational()
    parseShift()
    while next is < <= > >=:
        parseShift()

parseShift()
    parseAdditive()
    while next is << or >>:
        parseAdditive()

parseAdditive()
    parseMultiplicative()
    while next is + or -:
        parseMultiplicative()

parseMultiplicative()
    parseUnary()
    while next is * / %:
        parseUnary()

parseUnary()
    if next is unary operator:
        parseUnary()
    else:
        parsePostfix()

parsePostfix()
    parsePrimary()
    while next is call/index/member/postfix op:
        consume postfix op

parsePrimary()
    identifier | literal | "(" expression ")"