-
Notifications
You must be signed in to change notification settings - Fork 32
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
docs: Add a chapter on start states to the book #468
Conversation
doc/src/start_states.md
Outdated
The following explains the syntax and semantics of Start States in lrlex.<br> | ||
A working example can be found in the repository at [lrpar/examples/start_states](https://github.com/softdevteam/grmtools/tree/master/lrpar/examples/start_states) | ||
|
||
# Motivation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment: #
is really only for the top-level comment in an MD file (so the file should probably start with the line # Start states
) and then these comments should be ##
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in 3fad471
doc/src/start_states.md
Outdated
|
||
# Motivation | ||
|
||
Start states are a feature from lex which can be used to add a bit of context sensitivity to lexical analysis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"which can be used for context sensitive lexing" maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in d182e4a
doc/src/start_states.md
Outdated
Additionally the lexer has a stack of states, and matching rules perform actions which modify the stack. | ||
|
||
# The INITIAL start state | ||
By default unless specified otherwise all lex rules are members of the *INITIAL* start state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop "By default"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in d182e4a
doc/src/start_states.md
Outdated
<INITIAL>[\t \n]+ ; | ||
``` | ||
|
||
Being equivalent to the lex file below with no start states specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/equivalent to/This is/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in d182e4a
doc/src/start_states.md
Outdated
<Excl>=# <-Excl>; | ||
``` | ||
|
||
# Start state operators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this section should come earlier and be called something like "Differences from POSiX lex"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this one section higher, Which I believe does make sense because the section higher had start state operators in it, and the section renaming did seem appropriate too.
Should be fixed in aaaa782
This all looks good, and worth merging now. Can you line wrap to the same length as the other md files (I think 100 chars) and force push? |
Will try and do so later today, as well as going through and running all the code snippets. |
Because I made some additional changes (changed the link format so it would fit on 100 char lines), I was hesitant to squash/force push. I tested all the complete examples containing e.g. those containing I am happy with this now, and feel like it's ready for a squash. |
LGTM! Please squash. |
499c333
to
8b9754f
Compare
Squashed. |
Despite the fact that I am the terriblest writer, here is a rough draft for a chapter on start states.
I still need to test the code examples and stuff so marking as draft, but would appreciate any feedback.