question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add EOF symbol to match end of input

See original GitHub issue

Can be signified with $

Must be optional (grammars don’t have to contain it to be correct)

Need to make sure it works for both LALR and Earley, and with indentation.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
isidenticalcommented, Mar 17, 2019

Any update?

2reactions
erezshcommented, Jun 12, 2020

Just pushed this into master. You can now use $ in the LALR parser. (No Earley support yet)

Here’s an example from the tests that shows what it does:

def test_end_symbol2(self):
    grammar = """
        start: (a|b)+
        a: "a" ("x"|$)
        b: "b"
    """
    parser = _Lark(grammar)

   self.assertEqual(parser.parse('axa'), Tree('start', [Tree('a', []),Tree('a', [])]))
   self.assertRaises(UnexpectedInput, parser.parse, 'ab')

Read more comments on GitHub >

github_iconTop Results From Across the Web

character - Representing EOF in C code? - Stack Overflow
It is simply a condition that applies to a file stream when the end of the stream is reached.
Read more >
Storing the EOF (End of File) character in a char type
When there is no more input, getchar returns EOF. And in the above program, the variable c , with char type, is able...
Read more >
Explain the END OF FILE (EOF) with a C Program
Step 1: Open file in write mode. Step 2: Until character reaches end of the file, write each character in filepointer. Step 3:...
Read more >
End-of-file - Wikipedia
In computing, end-of-file (EOF) is a condition in a computer operating system where no more data can be read from a data source....
Read more >
FIO34-C. Distinguish between characters read from a file and ...
Because EOF is negative, it should not match any unsigned character value. However, this is only true for implementations where the int type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found