GithubHelp home page GithubHelp logo

ligurio / lark-grammars Goto Github PK

View Code? Open in Web Editor NEW
41.0 4.0 6.0 165 KB

Grammars suitable for lark parser and Hypothesis

License: ISC License

Python 100.00%
hypothesis property-based-testing lark grammars testing hypothesis-tests hypothesis-testing quality-assurance lark-grammars grammar-fuzzer

lark-grammars's Introduction

lark grammars

PyPI version

Grammars suitable for lark parser:

How-To Use:

$ python -m venv venv
$ python -m pytest tests/test_grammars.py
$ pip install lark_grammars
$ cat example.py
from lark_grammars import grammars                     
grammars.grammar_files['bc'] 

$ python generate.py --grammar grammars/tap13.lark
TAP version 13
1..861602252
not ok # Skipped

# - C o A 2 1 H

See grammars for other parsers:

lark-grammars's People

Contributors

anentropic avatar ligurio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lark-grammars's Issues

TAP plan can appear at the bottom of the stream too

Hi!

Thanks for lark-grammars, I had a look at the grammar (I'm trying to write a PEG for TAP13) but it looks like the grammar in this repository supports only the plan at the beginning of the stream. From their docs:

It must appear once, whether at the beginning or end of the output.

Thanks!

Making regex.lark compatible with current version of Lark

Hi,

Thank you for publishing these grammars ๐Ÿ˜„ ๐Ÿ‘

I don't know if it was built against an old version of Lark, but I could not parse the regex.lark grammar with the current version.

After fixing all the errors, a version that does parse is:

%import common (INT, DECIMAL)

start		: regex

regex		: regex_ere
		| regex_bre

regex_ere	: rex ~ 1..20

rex		: LETTER 
          	| ( range
            	| rex repetition
            	| rex "|" rex
            	| ( "(" rex ")" | "\\" DECIMAL)
            	| "\\" ("w" | "W" | "<" | ">" | "b" | "B" | "`" | "'" | "r" | "n")
            	| "(" rex+ ")" )

repetition	: "*" | "+" | "?"
         	| "{" INT "}"
         	| "{" INT "," "}"
         	| "{" "," INT"}"
         	| "{" INT "," INT "}"

range		: "[" "^"? range_elt* "$"? "]"

LETTER		: /[0-9a-zA-Z]/

NAMED_RANGE_ELT	: "[:alnum:]"
		| "[:alpha:]"
		| "[:cntrl:]"
		| "[:digit:]"
		| "[:graph:]"
		| "[:lower:]"
		| "[:print:]"
		| "[:punct:]"
		| "[:space:]"
		| "[:upper:]"
		| "[:xdigit:]"

range_elt	: NAMED_RANGE_ELT
         	| LETTER
         	| LETTER "-" LETTER

regex_bre	:

Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.