This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
669 B

  1. """
  2. Lark Grammar
  3. ============
  4. A reference implementation of the Lark grammar (using LALR(1) + standard lexer)
  5. """
  6. from lark import Lark
  7. parser = Lark(open('examples/lark.lark'), parser="lalr")
  8. grammar_files = [
  9. 'examples/python2.lark',
  10. 'examples/python3.lark',
  11. 'examples/lark.lark',
  12. 'examples/relative-imports/multiples.lark',
  13. 'examples/relative-imports/multiple2.lark',
  14. 'examples/relative-imports/multiple3.lark',
  15. 'lark/grammars/common.lark',
  16. ]
  17. def test():
  18. for grammar_file in grammar_files:
  19. tree = parser.parse(open(grammar_file).read())
  20. print("All grammars parsed successfully")
  21. if __name__ == '__main__':
  22. test()