|
Chris Maunder wrote: It's why I started CodeProject.
WHAT?
It wasn't for the fame, the money and the chicks?
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
They were just a bonus - it was pure altruism to start with!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm laughing a wry, hollow, laugh.
cheers
Chris Maunder
|
|
|
|
|
We all know about the CP Groupies.
That's why you keep running off back to Oz - exhaustion!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
there will be no confusion about that. my project is entirely distinct, and if anything would just have an import feature. There is no cross-polination going on. It would be like Libre Office importing a word document.
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.
|
|
|
|
|
Having been bitten by a similar disappearing parser generator in the past, I'd suggest you're doing people a service...
Personally, I moved over to ANTLR after that, but these days, I try to keep to parser combinator libraries - at least if I'm compiling from source, I can configure it easily & have got some chance of adding features and/or fixing bugs...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
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.
|
|
|
|
|
I've been using PEG (Parsing Expression Grammars) recently - it's a bit different to EBNF & more oriented towards recursive descent parsers, but is quite nice. It doesn't have some niceties (such as case insensitive matching - although I would have thought that could be added easily enough).
The particular parser generator I've been using automates whitespace processing (see %whitespace ), necessitating token indicators (expressions surrouned by < and > ), and also allows productions to be marked as ignored (with a leading ~ ). It also has an online parser checker & processor, which has been useful - apart from when I found a pathological case in the generated code for the parser's grammar...
License <- LicenseTerm (EOL LicenseTerm)* EOL*
LicenseTerm <- SecretTerm / TimeTerm / LocationTerm / IdentityTerm
SecretTerm <- SECRET EQUAL < REST_OF_LINE >
REST_OF_LINE <- ( !EOL_C . )+
LocationTerm <- ANYWHERE / NodeTerm
NodeTerm <- NODE EQUAL NO_SPACE_STRING
IdentityTerm <- ANYONE / UserTerm / DomainTerm
UserTerm <- USER EQUAL NO_SPACE_STRING
DomainTerm <- DOMAIN EQUAL NO_SPACE_STRING
TimeTerm <- PerpetualTerm / ExpiryTerm
PerpetualTerm <- PERPETUAL
ExpiryTerm <- EXPIRY EQUAL ExpiryDate
ExpiryDate <- TermLength / EndDate
TermLength <- NATURAL TermUnit
TermUnit <- DAY_UNIT / WEEK_UNIT / MONTH_UNIT / YEAR_UNIT
WEEK_UNIT <- < [Ww][Ee][Ee][Kk] [Ss]? >
MONTH_UNIT <- < [Mm][Oo][Nn][Tt][Hh] [Ss]? >
DAY_UNIT <- < [Dd][Aa][Yy] [Ss]? >
YEAR_UNIT <- < [Yy][Ee][Aa][rR] [Ss]? >
EndDate <- ISO8601 / NamedDate
ISO8601 <- < ISOYEAR DASH ISOMONTH DASH ISODAY >
ISOYEAR <- DIGIT DIGIT DIGIT DIGIT
ISOMONTH <- DIGIT DIGIT
ISODAY <- DIGIT DIGIT
NamedDate <- DAY MonthName YEAR
MonthName <- JAN / FEB / MAR / APR / MAY / JUN / JUL / AUG / SEP / OCT / NOV / DEC
YEAR <- < DIGIT DIGIT DIGIT DIGIT >
JAN <- < [Jj][Aa][Nn] ( [Uu][Aa][Rr][Yy] )? >
FEB <- < [Ff][Ee][Bb] ( [Rr][Uu][Aa][Rr][Yy] )? >
MAR <- < [Mm][Aa][Rr] ( [Cc][Hh] )? >
APR <- < [Aa][Pp][Rr] ( [Ii][Ll] )? >
MAY <- < [Mm][Aa][Yy] >
JUN <- < [Jj][Uu][Nn] ( [Ee] )? >
JUL <- < [Jj][Uu][Ll] ( [Yy] )? >
AUG <- < [Aa][Uu][Gg] ( [Uu][Ss][Tt] )? >
SEP <- < [Ss][Ee][Pp] ( [Tt][Ee][Mm][Bb][Ee][Rr] )? >
OCT <- < [Oo][Cc][Tt] ( [Oo][Bb][Ee][Rr] )? >
NOV <- < [Nn][Oo][Vv] ( [Ee][Mm][Bb][Ee][Rr] )? >
DEC <- < [Dd][Ee][Cc] ( [Ee][Mm][Bb][Ee][Rr] )? >
DAY <- < DIGIT DIGIT? >
~DASH <- < '-' >
DIGIT <- [0-9]
~EQUAL <- < '=' >
NATURAL <- < DIGIT+ >
NO_SPACE_STRING <- < (![ \t\n\r] .)+ >
~ANYONE <- < [Aa][Nn][Yy][Oo][Nn][Ee] >
~ANYWHERE <- < [Aa][Nn][Yy][Ww][Hh][Ee][Rr][Ee] >
~NODE <- < [Nn][Oo][Dd][Ee] >
~DOMAIN <- < [Dd][Oo][Mm][Aa][Ii][Nn] >
~USER <- < [Uu][Ss][Ee][Rr] >
~EXPIRY <- < [Ee][Xx][Pp][Ii][Rr][Yy] >
~PERPETUAL <- < [Pp][Ee][Rr][Pp][Ee][Tt][Uu][Aa][Ll] >
~SECRET <- < [Ss][Ee][Cc][Rr][Ee][Tt] >
%whitespace <- [ \t]*
~EOL <- < EOL_C+ >
~EOL_C <- [\n\r]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm familiar with PEG. Some of it is quite nice, but my main issue with it is it's far too easy to introduce ambiguities into the grammar, which makes it fine for parsing say, JSON or even xml or something, but maybe not javascript or something else where there's a lot of unseen ambiguity that must be accounted for (trailing else on a nested if being one example)
PEG doesn't really have grammar conflicts. For really complicated grammars, you want conflict detection.
I've considered implementing one, as it would be if nothing else, in the interest of completeness. It doesn't use the CFG model like the main major parsing algos do, so it would take some doing. I don't have good material to show me how they work (the memoization techniques they use for example)
I could make one now, but it wouldn't be efficient without that stuff.
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.
|
|
|
|
|
i don't even know where to post this as I don't know where to begin.
i have a profound need to translate a finite state machine into a regular expression.
the methods presented to me, of which I am aware of 3, are all presented using math formalisms that are as of yet beyond me.
i've *almost* implemented a variation of the state removal method but I got caught on the loops.
if anyone has any idea what I'm talking about and knows C# or C or C++ reply and i can shoot you my email addy or something.
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.
|
|
|
|
|
You can rent my brain, but not borrow it, when you are sober
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
do you know the magic of FA to regular expression conversion? I could probably buy you beer for the lesson or something. =)
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.
|
|
|
|
|
codewitch honey crisis wrote: do you know the magic of FA to regular expression conversion? Sorry, I don't have the drugs for that, now
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I have tutorials
Ing. Petr Zemek - Projekty[^]
like that one, but i don't understand them.
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.
|
|
|
|
|
|
there are few things more frustrating than knowing a problem is solvable, having several "tutorials" to solve it and still being not much closer than when you started.
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.
|
|
|
|
|
Never done that myself - but this repo might be of use - a Java class that does just what you want?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You sir, just made my effing day. I've been at this problem on and off for years.
i don't know i didn't find that. a single tool that does exactly what i need to understand and no more.
PERFECTION
you are my hero for today.
edit: eck, zero comments in this thing, and uses some java class libraries i'm not familiar with but it's closer to the mark than anything i've come across so far. Between this, and what i understand of the state removal algorithm, i should be able to put something together with it. THANK YOU
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.
modified 29-Jul-19 16:56pm.
|
|
|
|
|
Many years ago, I enjoyed coding our work-based application with VB5 connecting to an Access database. I've been retired for 10 years, and would now like to do something similar. But I'm now using an Apple Mac, so VB and Access is out, unless I go down the route of Parallels, which will be expensive.
I have looked at Python, but it appears to be used for creating rather simplistic text-based apps. What I would like to be able to do is what I did with VB, for example connect to a database, draw a form, and drop onto it text boxes, buttons, drop-down lists, etc. I don't see anywhere where Python lets me do this. If it does, how?
I also loved the coding associated with VB5, which seemed much more intuitive than languages such as C etc. Any advice gratefully received.
|
|
|
|
|
|
My experience has been (and you'll have to forgive me, folks, because i'm sure it's limited) that rapid application development with all the wysiwyg form editing and such is the primary domain of windows.
I think apple had like, CodeWarrior that may have had some RAD stuff in it but all the open source offerings I've seen are junk.
Visual Studio (which includes VB.net) was and still is the best RAD IDE on the market, just like it was when you left the fold.
I'm pretty disappointed actually. You may want to ditch VB and just move to C#. You can write .NET apps that run anywhere these days - linux, android, wherever but VB is the red headed stepchild of the .NET language family.
all of this is my $0.02.
I'm out of the field like you, but still code a lot.
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.
|
|
|
|
|
I think you missed the OP ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I most certainly did. I responded prior to proper caffeination and fully upright state. Apparently my humor hadn't engaged yet. =)
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.
|
|
|
|
|
I know the feeling well!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|