Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jzimmerman64
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
jzimmerman64
4y ago
> I can say that this is a crux for me because, if you convince me that the linear-time guarantee is this important and that langcc has it The fact that langcc has the linear-time guarantee follows from the fact that it generates shift&#
2.
▲
by
jzimmerman64
4y ago
> everyone in the community who's brought this up has said something along the lines of "the days of handwritten parsers are over." I am aware of this "consensus", but I believe it is largely wishful thinking. Pr
3.
▲
by
jzimmerman64
4y ago
The preprocessor would likely have to be a separate ad-hoc step, but it is possible that langcc could be used to generate a full C frontend if one is willing to run two passes (needed to deal with ambiguous cases such as "x * y",
4.
▲
by
jzimmerman64
4y ago
> Generating the tree is trivial. If by "generating the tree" you mean generating definitions for the AST data structures, this is nontrivial enough that yacc does not do it. > The lexer is part of the parser. Again, yacc (a
5.
▲
by
jzimmerman64
4y ago
Readers who are interested in parsing theory may also enjoy the companion technical report: https://arxiv.org/pdf/2209.08383.pdf as well as a brief users' manual, available here: https://arxiv.org/
6.
▲
by
jzimmerman64
4y ago
> back when it was considered impossibly impractical (the "dragon book" said so!) Yes, with some optimizations (e.g., Pager's algorithm), LR(1) can be practical; in langcc we even implement LR(k), and this is also practica
7.
▲
by
jzimmerman64
4y ago
> Whereas langcc boasts automatically-generated parsers for the easy-to-parse Python and Go, my old employer has automatically-generated parsers for Ruby, C++, COBOL, and about 100 others. Python may be (comparatively) easy to parse, but
8.
▲
by
jzimmerman64
4y ago
It's not just a parser generator; it also generates the AST, traversals, lexer, and pretty-printer. And it can generate the AST for your IRs and target language, if you specify them in BNF as well. This is a pretty significant piece of
9.
▲
by
jzimmerman64
4y ago
Many of these claims are subjective, but I will at least point out one fact: langcc is general enough to compile its own frontend - and not just for experimentation.
10.
▲
by
jzimmerman64
4y ago
Correct. The C/C++ grammar is not complete; it only encodes the subset of the language that was needed to bootstrap langcc itself. As far as I am aware, however, the Python grammar parses the full industrial language Python 3.9.12.
11.
▲
by
jzimmerman64
4y ago
As far as we are aware, the grammars included with langcc (go.lang and py.lang) parse the full industrial programming languages Golang 1.17.8 and Python 3.9.12. They are not restricted subsets (even though cc.lang is a restricted subset of
12.
▲
by
jzimmerman64
4y ago
The README is a work in progress, but some of these answers can be found in the documentation ( https://arxiv.org/abs/2209.08385 ). In particular: > How are the error messages? langcc produces "confusing input pa
13.
▲
by
jzimmerman64
4y ago
The language of BNF for langcc ( https://github.com/jzimmerman/langcc/blob/main/grammars/meta... ) provides many syntactic conveniences that are not present in a Lisp-like language, so the fact that l
14.
▲
by
jzimmerman64
4y ago
> I suggest the developer also look into auto-generated visitor / traversal functions as well In fact, langcc already has visitor/traversal functions, though they are not so well documented yet. I have just added an example (ex