Click here to Skip to main content
15,913,854 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: This is kind of an ethical question. Pin
Michael Martin27-Jul-19 17:43
professionalMichael Martin27-Jul-19 17:43 
GeneralRe: This is kind of an ethical question. Pin
OriginalGriff27-Jul-19 21:34
mveOriginalGriff27-Jul-19 21:34 
GeneralRe: This is kind of an ethical question. Pin
Chris Maunder28-Jul-19 14:41
cofounderChris Maunder28-Jul-19 14:41 
GeneralRe: This is kind of an ethical question. Pin
OriginalGriff28-Jul-19 20:23
mveOriginalGriff28-Jul-19 20:23 
AnswerRe: This is kind of an ethical question. Pin
Asday29-Jul-19 2:05
Asday29-Jul-19 2:05 
GeneralRe: This is kind of an ethical question. Pin
honey the codewitch29-Jul-19 2:31
mvahoney the codewitch29-Jul-19 2:31 
AnswerRe: This is kind of an ethical question. Pin
Stuart Dootson29-Jul-19 5:03
professionalStuart Dootson29-Jul-19 5:03 
GeneralRe: This is kind of an ethical question. Pin
honey the codewitch29-Jul-19 5:43
mvahoney the codewitch29-Jul-19 5:43 
i have a love/hate relationship with ANTLR.

Mostly, I love its parsing algorithm, but hate its grammar and just the "feel" of the tools. in terms of the tools probably all the java. java is always such a slug.


The grammar is the big deal for me though. Ugh i hated it. Programmar (also gone) had THE best parser and grammar format. It's only downside was it didn't generate code, and it was commercial, but it was brilliant.

It inspired the grammar format I use, which frankly, I think is better than anything else currently out there, if i do say so myself. I mean - it's clean, intuitive, supports all the nice little constructs, lets you shape the parse tree with it, has attributes, and lets you declare your terminals in A/EBNF or regex. without requiring a separate section for them in the grammar (though i generally segregate them for good practice)

/****************************************************************\
*  ebnf.ebnf: a self describing grammar for describing grammars  *
*   by codewitch honey crisis, july 2019                         *
\****************************************************************/

grammar<start>= productions;

//
// productions
//
// marking a non-terminal with collapse removes it from 
// the tree and propagates its children to its parent
// marking a terminal with it similarly hides it from
// the result but not from the grammar, unlike hidden
//
productions<collapsed> = production productions | production;
production= identifier [ "<" attributes ">" ] "=" expressions ";";

//
// expressions
//
expressions<collapsed>= expression { "|" expression }; 
expression= { symbol };
symbol= literal | regex | identifier | 
	"(" expressions ")" | 
	"[" expressions "]" |
	"{" expressions ("}"|"}+");

//
// attributes
//
// recognized attributes are hidden, collapsed, terminal, start, 
// followsConflict (which can be "error", "first" or "last")
// and blockEnd (string)
attributes<collapsed>= attribute { "," attribute};
attribute<color="red">= identifier [ "=" attrvalue ];
attrvalue<color="orange">= literal | integer | identifier;

//
// terminals
//
literal= '"([^"\\]|\\.)*"';
regex= '\'([^\'\\]|\\.)*\'';
identifier= '[A-Z_a-z][\-0-9A-Z_a-z]*';
integer= '\-?[0-9]+';

// hide comments and whitespace
//
// if you mark a production with the terminal attribute, you
// can use ebnf to define it. Anything that's text or regex 
// is automatically a terminal
whitespace<hidden,terminal>= {" "|"\v"|"\f"|"\t"|"\r"|"\n"}+; //'[ \v\f\t\r\n]+';
// single quotes denote regex. make sure to escape single
// quotes in the regex with \'
// attributes get passed through to the parser, and you can define your own
lineComment<hidden,color="green">= '//[^\n]*[\n]';
blockComment<hidden,blockEnd="*/",color="green">= "/*";

// defining these isn't required, but gives
// us better constant names
// double quotes denote a literal. the escapes are nearly the
// same as C#. \U and \x are not supported
or="|";
lt="<";
gt=">";
eq="=";
semi=";";
comma=",";
lparen="(";
rparen=")";
lbracket="[";
rbracket="]";
lbrace="{";
rbrace="}";
rbracePlus="}+";

When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: This is kind of an ethical question. Pin
Stuart Dootson29-Jul-19 10:13
professionalStuart Dootson29-Jul-19 10:13 
GeneralRe: This is kind of an ethical question. Pin
honey the codewitch29-Jul-19 10:17
mvahoney the codewitch29-Jul-19 10:17 
Questioncan i borrow your brain? Pin
honey the codewitch27-Jul-19 8:20
mvahoney the codewitch27-Jul-19 8:20 
AnswerRe: can i borrow your brain? Pin
BillWoodruff27-Jul-19 9:38
professionalBillWoodruff27-Jul-19 9:38 
GeneralRe: can i borrow your brain? Pin
honey the codewitch27-Jul-19 9:40
mvahoney the codewitch27-Jul-19 9:40 
GeneralRe: can i borrow your brain? Pin
BillWoodruff27-Jul-19 9:47
professionalBillWoodruff27-Jul-19 9:47 
GeneralRe: can i borrow your brain? Pin
honey the codewitch27-Jul-19 9:52
mvahoney the codewitch27-Jul-19 9:52 
AnswerRe: can i borrow your brain? Pin
PIEBALDconsult27-Jul-19 10:30
mvePIEBALDconsult27-Jul-19 10:30 
GeneralRe: can i borrow your brain? Pin
honey the codewitch27-Jul-19 10:46
mvahoney the codewitch27-Jul-19 10:46 
AnswerRe: can i borrow your brain? Pin
Stuart Dootson29-Jul-19 10:16
professionalStuart Dootson29-Jul-19 10:16 
GeneralRe: can i borrow your brain? Pin
honey the codewitch29-Jul-19 10:20
mvahoney the codewitch29-Jul-19 10:20 
GeneralGetting back into it Pin
Eaststander27-Jul-19 3:50
Eaststander27-Jul-19 3:50 
GeneralRe: Getting back into it Pin
OriginalGriff27-Jul-19 4:16
mveOriginalGriff27-Jul-19 4:16 
GeneralRe: Getting back into it Pin
honey the codewitch27-Jul-19 7:21
mvahoney the codewitch27-Jul-19 7:21 
GeneralRe: Getting back into it Pin
OriginalGriff27-Jul-19 8:18
mveOriginalGriff27-Jul-19 8:18 
GeneralRe: Getting back into it Pin
honey the codewitch27-Jul-19 8:26
mvahoney the codewitch27-Jul-19 8:26 
GeneralRe: Getting back into it Pin
OriginalGriff27-Jul-19 8:44
mveOriginalGriff27-Jul-19 8:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.