mirror of https://github.com/tbklang/tlang.git
Lexer interface #105
Labels
No Label
dependency
emit
hashmapper
lebanonmapper
lexer
meta
needsfix
parser
qol
question
resolution
typing
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 1 hour 31 minutes
Due Date
deavmi
1 hour 31 minutes
Blocks
#139 🧹️🧼️ Cleanup: Clean up series
tlang/tlang
Reference: tlang/tlang#105
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is this?
The point of this feature request is to declare a set of files that hold
Token
,LexerInterface
and then a generalizedLexerInterface
. The interface should declare the general structure that a parser must adhere to in order to be used, namely:getCurrentToken()
method which returns aToken
nextToken()
,previousToken()
setCursor(ulong)
andgetCursor()
hasTokens()
to check if there are more tokens to come considering the current cursor positiongetTokens()
getLine()
andgetColumn()
to know where in the source text we areParser interfaceto Lexer interface🔐️ Locking for now till I stabilize stuff and onboard @rany
I have pushed a definition for
LexerInterface
nowTodo 📝
getTokens()
to the interface APIgetTokens()
, which exhaustively callsgetTokens()
till it cannot anymore. Useful for unit tests where we need to compare tokens.getLine()
andgetColumn()
Questions 🤔
getTokens()
is common codeabstract class
rather than aninterface
in the case ofgetTokens()
, as we could simply call it exhaustively ourselves. It would be common codedefault
~final
interface method for this, mmmh, however maybe we do? We would need to reset the cursor each time - it is doable but we can see - honestly who would callgetTokens()
in places other than unit tests and also more than once? It will not change.Currently doing this crashes with out of bounds, need to check how
basic.d
works.I want to start work on this soon :). Maybe once I finish some of the type checking stuff up.
feature/lexer_interfaceto feature/clean_lexer_interfaceThis lexer interface is done now.
Awaiting CI/CD ...
Looks like the CI/CD is all green ✅ - closing