Compare commits
8 Commits
89a60e620e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ac71fa1c3 | ||
|
|
9232432c35 | ||
|
|
b536b01eeb | ||
|
|
8175a9d4c5 | ||
|
|
3dd2ea83d3 | ||
|
|
b7631530bc | ||
|
|
fa1d8efe55 | ||
| e74aff3299 |
12
README.md
12
README.md
@@ -16,7 +16,7 @@ A directory of ARF files is called a module, and modules will compile to object
|
||||
files (one per module) using C as an intermediate language (maybe LLVM IR in the
|
||||
future).
|
||||
|
||||
## Design aspects
|
||||
## Design Aspects
|
||||
|
||||
These are some design goals that I have followed/am following:
|
||||
|
||||
@@ -32,7 +32,7 @@ These are some design goals that I have followed/am following:
|
||||
- One line at a time - the language's syntax should encourage writing code that
|
||||
flows vertically and not horizontally, with minimal nesting
|
||||
|
||||
## Planned features
|
||||
## Planned Features
|
||||
|
||||
- Type definition through inheritence
|
||||
- Struct member functions
|
||||
@@ -49,3 +49,11 @@ These are some design goals that I have followed/am following:
|
||||
- [ ] Semantic tree -> C -> object file
|
||||
- [ ] Figure out HOW to implement generics
|
||||
- [ ] Create a standard library
|
||||
|
||||
## Compiler Progress
|
||||
|
||||
<img src="assets/heatmap.png" alt="Progress heatmap" width="400">
|
||||
|
||||
- Yellow: needs to be completed for the MVP
|
||||
- Lime: ongoing progress in this area
|
||||
- Green: Already completed
|
||||
|
||||
BIN
assets/heatmap.png
Normal file
BIN
assets/heatmap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -242,9 +242,15 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
|
||||
err = lexer.nextRune()
|
||||
case '!':
|
||||
token := lexer.newToken()
|
||||
token.kind = TokenKindExclamation
|
||||
lexer.addToken(token)
|
||||
err = lexer.nextRune()
|
||||
if err != nil { return }
|
||||
token.kind = TokenKindExclamation
|
||||
if lexer.char == '=' {
|
||||
token.kind = TokenKindNotEqualTo
|
||||
err = lexer.nextRune()
|
||||
token.location.SetWidth(2)
|
||||
}
|
||||
lexer.addToken(token)
|
||||
case '%':
|
||||
token := lexer.newToken()
|
||||
token.kind = TokenKindPercent
|
||||
@@ -255,6 +261,11 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
|
||||
token.kind = TokenKindTilde
|
||||
lexer.addToken(token)
|
||||
err = lexer.nextRune()
|
||||
case '=':
|
||||
token := lexer.newToken()
|
||||
token.kind = TokenKindEqualTo
|
||||
lexer.addToken(token)
|
||||
err = lexer.nextRune()
|
||||
case '<':
|
||||
token := lexer.newToken()
|
||||
err = lexer.nextRune()
|
||||
@@ -264,6 +275,10 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
|
||||
token.kind = TokenKindLShift
|
||||
err = lexer.nextRune()
|
||||
token.location.SetWidth(2)
|
||||
} else if lexer.char == '=' {
|
||||
token.kind = TokenKindLessThanEqualTo
|
||||
err = lexer.nextRune()
|
||||
token.location.SetWidth(2)
|
||||
}
|
||||
lexer.addToken(token)
|
||||
case '>':
|
||||
@@ -275,6 +290,10 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
|
||||
token.kind = TokenKindRShift
|
||||
err = lexer.nextRune()
|
||||
token.location.SetWidth(2)
|
||||
} else if lexer.char == '=' {
|
||||
token.kind = TokenKindGreaterThanEqualTo
|
||||
err = lexer.nextRune()
|
||||
token.location.SetWidth(2)
|
||||
}
|
||||
lexer.addToken(token)
|
||||
case '|':
|
||||
|
||||
@@ -153,9 +153,13 @@ func TestTokenizeAll (test *testing.T) {
|
||||
quickToken(1, TokenKindExclamation, nil),
|
||||
quickToken(1, TokenKindPercent, nil),
|
||||
quickToken(1, TokenKindTilde, nil),
|
||||
quickToken(1, TokenKindEqualTo, nil),
|
||||
quickToken(2, TokenKindNotEqualTo, nil),
|
||||
quickToken(1, TokenKindLessThan, nil),
|
||||
quickToken(2, TokenKindLessThanEqualTo, nil),
|
||||
quickToken(2, TokenKindLShift, nil),
|
||||
quickToken(1, TokenKindGreaterThan, nil),
|
||||
quickToken(2, TokenKindGreaterThanEqualTo, nil),
|
||||
quickToken(2, TokenKindRShift, nil),
|
||||
quickToken(1, TokenKindBinaryOr, nil),
|
||||
quickToken(2, TokenKindLogicalOr, nil),
|
||||
|
||||
@@ -45,11 +45,13 @@ const (
|
||||
TokenKindPercent
|
||||
TokenKindTilde
|
||||
|
||||
// TODO: add equal to, less than or equal to, greater than or equal to,
|
||||
// not equal to
|
||||
TokenKindEqualTo
|
||||
TokenKindNotEqualTo
|
||||
TokenKindLessThanEqualTo
|
||||
TokenKindLessThan
|
||||
TokenKindLShift
|
||||
TokenKindGreaterThan
|
||||
TokenKindGreaterThanEqualTo
|
||||
TokenKindRShift
|
||||
TokenKindBinaryOr
|
||||
TokenKindLogicalOr
|
||||
@@ -175,12 +177,20 @@ func (tokenKind TokenKind) Describe () (description string) {
|
||||
description = "Percent"
|
||||
case TokenKindTilde:
|
||||
description = "Tilde"
|
||||
case TokenKindEqualTo:
|
||||
description = "EqualTo"
|
||||
case TokenKindNotEqualTo:
|
||||
description = "NotEqualTo"
|
||||
case TokenKindLessThan:
|
||||
description = "LessThan"
|
||||
case TokenKindLessThanEqualTo:
|
||||
description = "LessThanEqualTo"
|
||||
case TokenKindLShift:
|
||||
description = "LShift"
|
||||
case TokenKindGreaterThan:
|
||||
description = "GreaterThan"
|
||||
case TokenKindGreaterThanEqualTo:
|
||||
description = "GreaterThanEqualTo"
|
||||
case TokenKindRShift:
|
||||
description = "RShift"
|
||||
case TokenKindBinaryOr:
|
||||
|
||||
@@ -289,8 +289,6 @@ func (parser *ParsingOperation) parseIdentifier () (
|
||||
identifier.location = parser.token.Location()
|
||||
|
||||
for {
|
||||
// TODO: eat up newlines and tabs after the dot, but not before
|
||||
// it.
|
||||
if !parser.token.Is(lexer.TokenKindName) { break }
|
||||
|
||||
identifier.trail = append (
|
||||
@@ -301,6 +299,18 @@ func (parser *ParsingOperation) parseIdentifier () (
|
||||
if err != nil { return }
|
||||
|
||||
if !parser.token.Is(lexer.TokenKindDot) { break }
|
||||
|
||||
err = parser.nextToken()
|
||||
if err != nil { return }
|
||||
|
||||
// allow the identifier to continue on to the next line if there
|
||||
// is a line break right after the dot
|
||||
for parser.token.Is(lexer.TokenKindNewline) ||
|
||||
parser.token.Is(lexer.TokenKindIndent) {
|
||||
|
||||
err = parser.nextToken()
|
||||
if err != nil { return }
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@@ -31,7 +31,7 @@ data ro nestedObject:Obj
|
||||
.this
|
||||
.bird0 324
|
||||
.bird1 "hello world"
|
||||
data ro object:Obj
|
||||
data ro object:thing.thing.thing.thing
|
||||
.that 2139
|
||||
.this 324
|
||||
`, test)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
:arf
|
||||
--- rw -> -349820394 932748397 239485.37520 "hello world!\n" 'E' helloWorld:.,..[]{}
|
||||
+ - ++ -- * / @ ! % ~ < << > >> | || & &&
|
||||
+ - ++ -- * / @ ! % ~ = != < <= << > >= >> | || & &&
|
||||
|
||||
@@ -22,7 +22,9 @@ data ro integerArrayInitialized:{Int 16}
|
||||
|
||||
# data wr mutIntegerPointerInit:{Int}:mut [& integer]
|
||||
|
||||
data ro object:Obj
|
||||
# TODO: maybe test identifiers somewhere else?
|
||||
data ro object:thing.thing.
|
||||
thing.thing
|
||||
.this 324
|
||||
.that 2139
|
||||
|
||||
|
||||
Reference in New Issue
Block a user