Re: Lua syntax ambiguity
"'Martin Eden' via lua-l" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
On 2026-08-17 19:02, Roberto Ierusalimschy wrote:
> On the other hand, you can blindly add a space after each token and
> everything works.
>
> -- Roberto
Of course we can just emit separators everywhere, just in case.
Who cares?
“The History of every major Galactic Civilization tends to pass through
three distinct and recognizable phases, those of Survival, Inquiry and
Sophistication, otherwise known as the How, Why, and Where phases. For
instance, the first phase is characterized by the question 'How can we
eat?' the second by the question 'Why do we eat?' and the third by the
question 'Where shall we have lunch?”
-- Douglas Adams
But implementing it properly (emit only required separators) looks
hard for me. Node serializers have no information about surroundings,
and their caller don't know what serializer will emit.
F.e. "t={['a']=1}": we emitted "[", we know we are just opened index.
But to what "a" will be serialized is not our business. Maybe it will
be ""a"", maybe "'a'", maybe "[[a]]", maybe '\097', maybe
"(function()return 'a'end)()"...
So we must decide whether or not emit " " before calling node serializer.
That's impossible with such design.
( I still consider Lua is a nice language for manually writing code
(and trying to understand it later). (Comparing with what C had become,
C# and Perl.)
That syntax quirks ("[[[a]]]", "a=f ()" is not "a=f\n()", no empty
charsets for regexps) arise mostly from code generation.
Maybe I should just use LISP?
)
-- Martin
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/71396ccc-4685-4ae0-8180-f336be56ddac%40disroot.org.