Lurker News
Could be engineering, interpersonal, strategic, etc. This is purposefully open-ended.

Comments (422) 126 threads

Show all comments

Showing thread 45 of 126

austincheney3 replies#
A simplified universal parsing format (AST) that equally describes all languages. It needs to allow seamless switching between different languages in the same file and also allow recursively nesting of different languages within each other without resulting in a deviating from the simplified parse format.

The solution is written and it appears correct and viable. As in all things related to parsers the devil's in the details in attempts to prove edge cases with exotic tests and use cases.

bordercases1 reply#
That sounds unbelievably useful, is it open source?
oldandtired1 reply#
Does this handle languages like Icon or Unicon in which the concept of "failure is always an option"?
austincheney#
I honestly don't know. I have only written lexers, the part that does the analysis, for a few languages. The output format is completely language agnostic though. Go read through the docs or play with the demo to see what the output format looks like.
yxhuvud1 reply#
How do the switching happen? You just allow a node in one language to be some root of another, or is it more complicated?
austincheney#
The structure is defined using the begin and stack data fields of a given token. The begin points to the index of the current token's parent and the stack describes the structure contained by that parent. Items in the global space have no parent, so I assign a begin value of -1 and stack value of global. I use -1 because there is no such index in an array.