Hacker News new | past | comments | ask | show | jobs | submit | fatih-erikli-cg's comments login

:= for assinging a variable sounds and looks weird to me

It's the walrus operator. Pascal and Python use it as well. You get used to it pretty quickly.

Pascal: https://www.freepascal.org/docs-html/ref/refse104.html#x224-... Python: https://docs.python.org/3/whatsnew/3.8.html#assignment-expre...


It was something introduced like a 1 april joke. Clean implementation of any programming language won't have that.

I actually think it’s more readable because it makes the distinction between assignment and equivalence very clear.

bugs originating from the similarity of == vs = has probably cost the industry millions over the last 3 decades.


That ship has long sailed. ALGOL 1958 used := and Pascal popularized it.

https://en.m.wikipedia.org/wiki/Assignment_(computer_science...


I think they scan the code by two characters because one is not enough for <= and => so what is why assignment is := or =:. Probably + is ++ too.

it's just a shorthand for var foo int = 5 vs foo := 5 where the type is derived from the assigned value.

I think 10000 is a lot enough for a queryable dataset. More of them is like computer generated things like logs etc.

Storing data in text costs less. A tcp connection to get some blog posts from another process is not necessary.

On other hand it's a mere blog post. You should not be bothered by TCP cost. But reliable data storage and reliability/restore (in case of backups) cost is a concern.

It is mostly a blog post. A usecase for a database that holds tables and rows is very rare in real world. I know noone who uses contacts app in their mobile phones. Access is already there with checkboxes, select inputs and everything for years. Noone uses.

Where and how do you handle the operator precedence? I couldn't find in the codebase.


I wrote about it at length here:

https://www.nhatcher.com/post/a-rustic-invitation-to-parsing...

The implementation in IronCalc follows that.


I'm cognizant it's just documentation, because the code is its own thing, but it seems to be a recursive descent parser https://github.com/ironcalc/IronCalc/blob/2c2228c2c26386b019...


[flagged]


The function for asterisks and slashes is called from the functions for pluses and minuses. The result is that asterisks and slashes are evaluated before pluses and minuses. It's actually very easy to understand once you get the idea.

https://en.wikipedia.org/wiki/Recursive_descent_parser


I don't think a recursion should be involved in the parser. Shift-reduce may be an answer but it does not fix the problem either if you try to implement that. I would like to see real code rather than written homework pieces.


You're conflating parsing of expressions with operator precedence parsers (aka Pratt parsers). IronCalc uses a recursive descent parser, and Pratt parsers are an optimization of recursive descent parsers. Pratt parsers have one function that implements all precedence levels, while recursive descent parsers have one function per precedence level, but they contain basically the same logic.

Source: 20 years ago I converted GCC's C++ parser from recursive descent to an operator precedence parser; obviously GCC respected precedence even before my work, which was purely an optimization. In fact the code I replaced had the note "The expression parser recurses through the various levels of precedence as specified in the grammar, rather than using an operator-precedence technique".

https://github.com/gcc-mirror/gcc/commit/b8b94c5ba81744d325f...


Operator precedence is an addition to parsing of expressions. Both of them is needed if you accept "2 + 1" kind of expression. "2 + 2 * 2" must be evaluated like "2 + (2 * 2)". Only expression parsing will evaluate them like 8.


You can choose: learn recursive descent parsing, or keep on being confidently incorrect.


Better not use popular toolchains then:

https://gcc.gnu.org/wiki/New_C_Parser

https://clang.llvm.org/features.html

I think this is a quite popular approach for multiple reasons. That being said, tree sitter uses GLR.


There is no recursion involved in parsing. You keep a stack for the tree.


Recursive descent uses the processor stack as the parsing stack.


Recursion is mostly involved in interpreter, and most of the time it is a bad practice. No recursion needed in parser.


Dunning-Krueger effect at its best, I am done arguing.


Nothing if my favorite programming language is installed in my pc. I make the computer fun for myself. Internet doesnt bring anything.


It's funny spammers no longer do spam but post spam generation tools


It is some piece of snow that falling from the opposite angle of the shadow. Nothing has changed in the pictures of our times.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: