This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
d=`find . -name '*.g4' | grep -v examples | grep -v Generated | sed 's#/[^/]*.g4##' | sort -u` | |
# find all other grammars in this directory and check if they are | |
# inconsistently combined or splitted. | |
for i in $d | |
do | |
for j in $i/*.g4 | |
do | |
spgrammar=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function PlaygroundExample() { | |
const createToken = chevrotain.createToken; | |
const Lexer = chevrotain.Lexer; | |
const EmbeddedActionsParser = chevrotain.EmbeddedActionsParser; | |
const tokenMatcher = chevrotain.tokenMatcher; | |
/** | |
* An Example of implementing a Calculator with embedded actions (semantics). | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar InternalAlf ; | |
entryRuleUnit : ruleUnit EOF ; | |
ruleUnit : ( ruleAnonymousPackage | rulePackageUnit | ruleClassifierUnitDefinition | ruleClassUnit | ruleDataTypeUnit | ruleAssociationUnit | ruleInteractionUnit | ruleBehaviorUnit | ruleFunctionUnit | ruleFeatureUnit ) ; | |
entryRuleAnonymousPackage : ruleAnonymousPackage EOF ; | |
ruleAnonymousPackage : rulePackageBody ; | |
entryRulePackageUnit : rulePackageUnit EOF ; | |
rulePackageUnit : ( ruleUnitPrefix rulePackageDefinition ) ; | |
entryRuleClassifierUnitDefinition : ruleClassifierUnitDefinition EOF ; | |
ruleClassifierUnitDefinition : ( ruleUnitPrefix ruleClassifierDeclaration ruleTypeBody ) ; | |
entryRuleClassUnit : ruleClassUnit EOF ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/lark-parser/lark/blob/d676df9b888ead42daffd31c035d95241bff0920/lark/grammars/lark.lark | |
// LarkParser.g4 | |
parser grammar LarkParser; | |
options { | |
tokenVocab = LarkLexer; | |
contextSuperClass=AttributedParseTreeNode; | |
} | |
start: (item? NL)* item? EOF ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start : module | |
module : moduledata | |
moduledata : MODULE modulename NEWLINE datalist NEWLINE* ENDMODULE | |
modulename : IDENTIFIER | |
| proccall | |
datalist : (NEWLINE | |
| declaration NEWLINE | |
| procedure NEWLINE)* | |
procedure : PROC proccall NEWLINE (functioncall NEWLINE)* ENDPROC | |
proccall : procname procparameter? |