Test of HN to See If This Displays Unicode 1F801 (UpArrow)
This is supposed to be "Upwards Arrow with small triangle arrowhead: ๐ It enters ok, lets see if it HN allows this Unicode character.
I appreciate the original simplicity of K & R, "The C Programming Language", 2nd Edition, and the relatively simple semantics of ANSI C89/ISO C90 compared to C99 and later.
You don't need complex parsing methods for ANSI C89/ISO C90 and you do not need the "lexer hack" to handle the typedef-name versus other "ordinary identifier" ambiguity.
A surprising number of colleges still teach K & R 2nd Edition C.
Whenever someone brags about using recursive-descent parsing methods, I always ask, are they using predictive, top-down parsing, or back-tracking?
I hope C never loses sight of it's roots nor morphs into C++ under the guise of creating a common subset, but which is really a disguised superset of C and C++
Please prevent the ever increasing demand for new features from overwhelming C's simplicity so it can no longer be parsed with simple methods.
This was for purposes of creating a top-down, predictive, recursive descent parser for Go.
I am curious on how Go is being parsed. LR, LL, or ?
I am also curious about the CellType and PortType of Active Oberon. Do these correspond to Go's ChannelType and possibly to OCCAM and CSP Send and Receive Channels?
WithStmt is easier to parse, more general and it doesn't need the Primary "." "(" "type" ")" at the beginning which appears only needed to distinguish Go ExpressionSwitchStmt from Go TypeSwitchStmt.
wgator2
But if you want his "Modula-2: A Complete Guide", its only $300 new!
Recommendation:
Find a subset grammar for Python, by doing a search on computer science classes on university sites. You will find the published Python subset grammars probably too small for your purposes, but they are a start.
See if any of those subset grammars meet your needs.
IF not, remove from the published official Python grammar, various features that you do not need or are not easily understood. I recommend you keep the production rule for "class"
When you get a subset grammar that meets your needs, it will have to be well-formed, meaning it passes reachability, derivability, and non-circularity tests, has no undefined non-terminals, and is complete with a start (i.e., goal symbol.
You should then remove left-recursion and left-factor the grammar so it is LL(1).
Run your grammar through some of the on-line syntax checking sites to be sure the grammar is unambigous and is LL(1). You can use the online Grammophone tool from the University of Calgary to check your subset grammar.
After the grammar passes the LL(1) tests, find a top-down, predictive, compiler-generator that generates recursive-descent parsers, and not tables. The compiler-generator will also perform tests on your grammar and let you know what needs fixing.
I forgot to mention that you will also need to define the lexical tokens needed for the scanner portion before you can generate your scanner and parser modules.
After you generate the scanner, parser, and a main module to call them, you will have created a fast syntax checker for your subset grammar.
Run the fast syntax checker, preferably within a program editor or IDE, as you write your Python programs
You can also create "template editing macros" that will insert into your editor, portions of a Python program, but with portions elided, that you gradually fill-in. Also, you can add syntax-highlighting to your editor.
This is supposed to be "Upwards Arrow with small triangle arrowhead: ๐ It enters ok, lets see if it HN allows this Unicode character.
There is both left and right recursion in the definition of <number>, but this EBNF (Wirth notation) uses iteration only:
number = digit { digit } [ "." digit { digit } ] .
C declaration syntax confounds even the experts.
I highly recommend this article to all interested in C and C++, and programming languages generally.
Not a const pointer, but a pointer to const int.
Tiobe language rankings for May 2019:
Rust is ranked 34th at 0.335%, below Lisp and Prolog. Go is ranked 19th at 1.114%. C is ranked 2nd at 14.233%
Rust does not have a stable, standard BNF grammar specification. The language reference document for Rust has 33 or 34 unspecified missing language definitions [see "FIXME" sections].
C++ is complex to parse. Clang and Gcc use back-tracking to parse C++ and there can be long compilation times.
Tiobe language rankings for May 2019:
Rust is ranked 34th at 0.335% below Lisp and Prolog
Go is ranked 19th at 1.114%.
In complexity and size, Go language is closer to C programming language than either Rust or C++. [Rust and C++ are much larger languages than Go.]
Lastly, Rust does not appear to have a standard BNF grammar specification and I counted around 33 FIXME unspecified sections in the reference document for Rust. I haven't even discussed the number of unstable features in Rust. in the Ref
Also recommend:
"On the Design of Programming Languages" N. Wirth
CS-TR-73-403 "Hints on programming language design" C.A.R. Hoare
"The Essence of Programming Languages" Niklaus Wirth
Niklaus Wirth 1984 ACM Turing Award Recipient Interviewed by Elina Trichina March 13, 2018 Federal Institute of Technology (ETH) Zurich, Switzerland
Go and C seem to have a large number of available software tools.
Based on the "size" of the reference documentation alone, C and Go appear to be the simplest to learn for beginners.
A beginner coming from a C background might choose to learn the "Go" language, of the 3 available choices: C++, Rust, and Go.
Other than it's declaration syntax, Go appears to have been designed to be the most familiar to a C programmer.
C++ is very large and complex, just look at the size of the reference documentation. The 4th edition of "The C++ Programming Language" doesn't even have an "Appendix A: Grammar" anymore.
Rust doesn't appear yet to be stable enough to even specify a BNF for it's grammar.
Of course, there are other programming languages out there that maybe are even better for a C programmer to learn, but we were not asked for our opinion of other PLs.
IF ('A' <= ch) & (ch <= 'Z') THEN ch := CHR(ORD(ch) + 32) END
But it looks like this just replaces the selected text so it may be more for formatting.
I prefer a new window to open so the selected text isn't altered.
I know I can program vEdit+ to do this, but that is not Linux.
But I currently select portions of text with a mouse by highlighting it, and then execute programs that accept that selection as input.
I no longer am limited to entire text that would be written to StdOut or piped or redirected and so could be treated as complete text files.
I can currently select and execute programs in a GUI in just 2 steps, using a mouse.
Admittedly, I integrated the <program to execute> into the GUI, but it was relatively simple.
To do this in Linux it looks like I would need to run a port of Plan9's Acme or the Wily editor.
The port of Plan9 is way more than I need, so I will look at Wily.
Maybe there are some other Linux editors that will do what my GUI currently does?
There is an interesting movie, "Flash of Genius," about Robert Kearns, an inventor and his interactions with Ford over the "delayed windshield wiper."
I won't reveal any details over the movie plot but there is a short scene where Kearns is lecturing his engineering students about engineering ethics, which reminds me of a documentary by PBS: "NOVA: Holocaust on Trial" (2000)
I cannot find this last movie anywhere, but <youtube> has it available. Should be mandatory viewing for engineers, but it is difficult to watch or listen to the details.
But it does not closely track the published Rust Grammar nor syntax rules in the Rust Reference. (See Rust-lang DOT org site.)
Although perhaps a Rust grammar could be extracted from the syntax rules in the Reference doc, it may be incomplete. For example, how do "as-yet-undocumented features" affect the current syntax rules in the Rust Reference?
So for now, it looks like C is easier to parse than Rust.
I cannot determine if the syntax of Rust is "better" than that of C.
At least the ISO "C" std. organization publishes a complete syntax of their language.
Perhaps someone knows where there is a complete grammar for the Rust language?
I cannot find one.
Too many uncontrolled factors (programmer's experience level with a given language, etc).
Simplicity, readability, and so much more.
I know, Bjarne Stroustrup seems to hate EC++ and claims it is dead, but tell that to game developers and the NASA Curiosity Mars Rover. You can't tell that to Opportunity, which does appear dead, but Embedded C++ is not to blame, just some dust storms on Mars.
Just curious as I have never seen TIOBE or other sites lump those into a single category.