https://github.com/antlr/grammars-v4
Revision 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC, committed by GitHub on 03 March 2024, 01:33:37 UTC
Bumps [trxgrep](https://github.com/kaby76/Domemtech.Trash) from 0.21.16 to 0.22.0. - [Commits](https://github.com/kaby76/Domemtech.Trash/commits) --- updated-dependencies: - dependency-name: trxgrep dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent ab9ab66
Tip revision: 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC
Bump trxgrep from 0.21.16 to 0.22.0 (#3990)
Bump trxgrep from 0.21.16 to 0.22.0 (#3990)
Tip revision: 3ba0d9b
BSL.g4
/* Based on documentation provided at https://docs.racket-lang.org/htdp-langs/beginner.html */
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
grammar BSL;
program
: defOrExpr+ EOF
;
defOrExpr
: definition
| expr
| testCase
| libraryRequire
;
definition
: '(' 'define' '(' name NAME+ ')' expr ')'
| '(' 'define' name expr ')'
| '(' 'define' name '(' 'lambda' '(' NAME+ ')' expr ')' ')'
| '(' 'define-struct' name '(' name* ')' ')'
;
expr
: '(' name expr+ ')'
| '(' 'cond' ('[' expr expr ']')+ ')'
| '(' 'cond' ('[' expr expr ']')* '[' 'else ' expr ']' ')'
| '(' 'if' expr expr expr ')'
| '(' 'and' expr expr+ ')'
| '(' 'or' expr expr+ ')'
| '’()'
| name
| NUMBER
| BOOLEAN
| STRING
| CHARACTER
;
testCase
: '(' 'check-expect' expr expr ')'
| '(' 'check-random' expr expr ')'
| '(' 'check-within' expr expr expr ')'
| '(' 'check-member-of' expr expr+ ')'
| '(' 'check-satisfied' expr name ')'
| '(' 'check-error' expr expr? ')'
;
libraryRequire
: '(' 'require' STRING ')'
| '(' 'require' name ')'
| '(' 'require' '(' name STRING ('(' STRING+ ')')? ')' ')'
| '(' 'require' '(' name STRING pkg ')' ')'
;
pkg
: '(' STRING STRING NUMBER NUMBER ')'
;
name
: SYMBOL
| NAME
;
// A symbol is a quote character followed by a name. A symbol is a value, just like 42, '(), or #false.
SYMBOL
: '’' NAME
;
// A name or a variable is a sequence of characters not including a space or one of the following:
// " , ' ` ( ) [ ] { } | ; #
NAME
: ([$%&!*+\\^_~] | [--:<-Za-z])+
;
// A number is a number such as 123, 3/2, or 5.5.
NUMBER
: INT
| INT '.' [0-9]* [1-9]
| INT '/' INT
;
INT
: [1-9] [0-9]*
| '0'
;
BOOLEAN
: '#true'
| '#T'
| '#t'
| '#false'
| '#F'
| '#f'
;
// A string is a sequence of characters enclosed by a pair of ".
// Unlike symbols, strings may be split into characters and manipulated by a variety of functions.
// For example, "abcdef", "This is a string", and "This is a string with \" inside" are all strings.
STRING
: '"' ([ -~])* '"'
;
// A character begins with #\ and has the name of the character.
// For example, #\a, #\b, and #\space are characters.
CHARACTER
: '#' '\u005C' [A-Za-z0-9]
| '#' '\u005C' 'space'
;
LANG
: '#lang' ~ ('\n' | '\r')* '\r'? '\n' -> channel (HIDDEN)
;
COMMENT
: ';' ~ ('\n' | '\r')* '\r'? '\n' -> channel (HIDDEN)
;
WS
: (' ' | '\r' | '\t' | '\u000C' | '\n') -> channel (HIDDEN)
;
Computing file changes ...