-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asm
-blocks parser
#837
Comments
TL;DR: Most of the work had to be scrapped as the somewhat reliable AST of TVM asm cannot be produced without having a hand-made parser, which would do typechecking and partial evaluation of the Fift-asm. Also see the UPD2. Wrote a significant chunk of Ohm parser's code and parts of later stage hacks to support defining new words (instructions), including the active words, which affect the parsing in a context-sensitive way — the active words take the following word as an argument to them! But then I realized, that:
A workaround for some of the issues above is the recursive-descent parser and a dictionary to keep track of. And it would require to keep its own stack, with type checking of items added to it and all that stuff. Otherwise we're left with just a slight expansion of possibilities of the current parser and a better recognition of built-in words in Fift-asm. UPD: Thinking on prohibiting the UPD2: So, let's introduce just the minor update here and make very primitive ASTs, not attributing for types or anything, as they can get really incorrect considering the 3rd point above (even if we get rid of the first two by restricting the capabilities). |
Note, that while it's possible to support the syntax via Ohm without constucting ASTs, it's impossible to support the AST generation without outsourcing that part of the parser to the recursive-descent one, which would also keep track of dictionary of words/instructions and the TVM stack, at least approximating it. [See this for more info](#837 (comment)).
…855) Note, that while it's possible to support the syntax via Ohm without constucting ASTs, it's impossible to support the AST generation without outsourcing that part of the parser to the recursive-descent one, which would also keep track of dictionary of words/instructions and the TVM stack, at least approximating it. [See this for more info](#837 (comment)). * test: add Fift libraries from TON Blockchain monorepo And apply a small fix to the parser — we cannot prohibit shadowing or removal of instructions because both are used in Fift library and beyond. However, that means that out of place `{` and `}` are possible when shadowing them. See the comment in `embed-fift-fif.tact` about such case, and why it's ok to move forward with it
The parser should produce ASTs for
asm
-blocks. This will ensure we are in control of error messages and also we can later implement a type-checker for theasm
-blocks.The text was updated successfully, but these errors were encountered: