Indentation-based language, with more elaborate semantics and syntax
vanaur opened this issue · 2 comments
Hello, excuse me for disturbing you again.
This time, it's to ask a question about your Wiki, which has allowed me to make a lot of progress on my project to create a parser for a ML-like mini language.
As you will have understood, I therefore resort to indentation. However, I encounter some difficulties when I experiment with a more complex syntax than the one presented in the Wiki.
In your example, you parser this code:
loop i 1 10 10
loop k 1 10
print k
print i
print j
I am now trying to analyze codes such as:
let foo = 2 + 1
or
let foo =
loop i 1 10
print i
2 + 1
These are of course examples for the preliminary tests.
In my implementation, I consider everything to be an instruction, but to be more precise and consistent, I named the instruction parser pexprs
:
let pexprs, pexprimpl = createParserForwardedToRef()
The problem I have is the fact that the indentation module of your example always asks for a new line to parse everything waiting for an expression with the pexprs
parser; that is to say all the other parsers. What is problematic....
Here is the post on which I posted my question on SO, and where I was able to solve a parallel problem, but this one still persists. (Please see the Edit on the SO link.)
Hoping of course not to disturb you, and waiting for a salutary answer from you; thank you.
The question you've asked on StackOverflow has an accepted answer. Please open another question on StackOverflow explaining where you're stuck. If possible, please include in your question a reduced parser implementation that is as simple as possible while still demonstrating the problem, along with a sample input and a description of the expected behaviour/output. If you don't get an answer on StackOverflow, please ping me in this thread.
Okay, thank you for your attention. Here is the new post created on SO.