flex
WebKit


flex | WebKit | |
---|---|---|
10 | 167 | |
3,698 | 8,327 | |
0.9% | 1.7% | |
7.6 | 10.0 | |
7 days ago | 4 days ago | |
C | JavaScript | |
GNU General Public License v3.0 or later | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
flex
-
Building Zerocalc, part I - rustc lexer and a lexer in rust
In this post, we will focus on tokenization. There are many ways to do tokenization, including using regular expressions or generating tokenizer code with generators such as flex. But what if we check how rustc's parser does it?
-
How to provide input file for Flex++?
I am using Flex++, which is Flex for C++ and I am having trouble setting the input file. Flex++ uses the FlexLexer class provided in FlexLexer.h to create the lexer object(https://github.com/westes/flex/blob/master/src/FlexLexer.h). In my main function I have
-
Do Regular Expressions only evaluate one line at a time?
Further applications of DFA and NFA: lex or flex, yacc or bison, and POE :-)
-
Cool C projects
How about writing a programming language using Flex and Bison? There are lots of good tutorials and examples out there.
-
Parser and Lexer bike-shedding
Some lexer generators (notably Flex) take input from a file handle by default. While you can always read a file into a string before passing it to the generated lexer, this is not seen as "the best" since you have to read in all the data into memory, which can be a lot.
-
A Good Tool for Resuming Parsers?
Ages ago, I loved writing domain-specific toy languages, and almost always used flex to generate lexers and GNU bison to generate the parser. I've begun a new toy project and I don't think those two will cut it this time, so I'm looking for other tools that integrate well with C++.
-
Please no
I don't understand :c don't lexers like Flex work off of regex rules? Isn't this the correct first step to parse it?
-
A work in progress C compiler from scratch
I wrote a C compiler using flex [1] and bison [2]. The glue between them is a bit hacky.
At some point ANTLR [3] looked promising, but these days I'd probably write a lexer and recursive descent parser by hand, then generate LLVM IR.
[1] https://github.com/westes/flex
-
Dealing with lex and yacc is DIFFICULT so little information is available about them!
github.com/westes/flex/releases
-
Qual’è il commento più assurdo che avete mai trovato nel sorgente di un software?
Un commento in flex, uno storico software, tanto per mostrare che anche i migliori fanno le cose alla buona.
WebKit
- WebKit Quirks
-
I Switched to Firefox and Never Looked Back
Webkit does this.
Examples:
- https://github.com/WebKit/WebKit/blob/main/Source/WebCore/pa...
- https://github.com/WebKit/WebKit/blob/main/Source/WebCore/pl...
-
TCC and the macOS Platform Sandbox Policy
The code snippets are purely declarative because they are reconstructed from the simple bytecode that the macOS sandbox library generates after evaluating the Scheme code. At that point any abstractions present in the source code are long gone and only predicates and actions remain.
If you look at typical SBPL source code you'll see it tends to contain a mix of straightforward, declarative `(allow …)` policies and custom functions/macros used to simplify repeated patterns. See https://github.com/WebKit/WebKit/blob/11b5279aec6113c661dac3..., for example.
- The Unraveling of Space-Time
- No same site = None cookies for iOS18
- Fixing a Bug in Google Chrome as a First-Time Contributor
- WebKit Enables WasmGC by Default
-
How far should a programming language aware diff go?
Even though it makes no sense for (2, 3) to be a result in those cases, that was just how I ended up reading it, and I was exceptionally confused about how the printed output could possibly happen.
A super nice example of how subtle differences can really change things though.
As a side note, ASI for JS is actually super easy to implement and the rules are actually really simple (leaving aside whether the feature itself is good :D ) as it's just "these specific statements can have a new line instead of a semicolon" - so in the parser instead of consume(semicolon) you can just do "semicolon or newline" (You can check the logic in JSC in https://github.com/WebKit/WebKit/blob/main/Source/JavaScript... - just look for autoSemicolon() or autoSemi() I can't recall off the top of my head)
-
The Programmer's Brain
It's not just a problem when you are an amateur. This is sth that every project should provide.
But there are also many projects which do. Sometimes you need to search a bit for it. Actually I would expect that most big projects have such documentation somewhere in some form.
- https://github.com/WebKit/WebKit/blob/main/Introduction.md
- https://www.chromium.org/developers/how-tos/getting-around-t...
- https://github.com/pytorch/pytorch/blob/main/CONTRIBUTING.md...
- https://returnn.readthedocs.io/en/latest/getting_started/tec...
And then for some popular projects you will also find some independent overviews:
- https://fabiensanglard.net/quake3/ (and many more on https://fabiensanglard.net/)
- https://tldp.org/LDP/khg/HyperNews/get/tour/tour.html
- https://realpython.com/cpython-source-code-guide/
One problem is of course that those documents can be outdated and don't go into much details. But they still will give you important insights and should be a good starting point.
What are some alternatives?
cpp-peglib - A single file C++ header-only PEG (Parsing Expression Grammars) library
chromium - The official GitHub mirror of the Chromium source
ocean - Programming language that compiles into a x86 ELF executable.
gecko-dev - Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
libfsm - DFA regular expression library & friends
WHATWG HTML Standard - HTML Standard
LKI - LKI's dotfiles.
firefox-ios - Firefox for iOS
imp - Imp is a statically typed and compiled scripting language with the goal of increasing programmer confidence.
xdg-desktop-portal - Desktop integration portal
RIOT - RIOT - The friendly OS for IoT
otter-browser - Otter Browser aims to recreate the best aspects of the classic Opera (12.x) UI using Qt5

