Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Forth lexer #1880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Forth lexer #1880

wants to merge 1 commit into from

Conversation

tkers
Copy link

@tkers tkers commented Oct 15, 2022

This adds a lexer for the Forth programming language.

forth-sample

Since this is a bit of an unusual language (lacking a rigid structure and syntax), there is a bit of a balancing act going on between accuracy and usability. The highlighting rules follow conventions that most editors with Forth support also follow (e.g. considering control structures such as IF/THEN and DO/LOOP as keywords, and considering words such as :, CREATE and VARIABLE as defining words, with the next word highlighted as the function name).

When working with more fancy code constructs that switch between compiler modes, or when creating higher order defining words, some of these highlights will inevitably be incorrect. These inaccuracies are usually limited to (the first word following) parsing words and should not "break the highlighting" for any larger parts of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant