Skip to content
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

Implement abstract syntax tree #11

Open
vtereshkov opened this issue Feb 28, 2020 · 0 comments
Open

Implement abstract syntax tree #11

vtereshkov opened this issue Feb 28, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@vtereshkov
Copy link
Owner

vtereshkov commented Feb 28, 2020

Currently XD Pascal generates machine instructions 'on-the-fly', like almost all early Pascal compilers, including Turbo Pascal. But building an AST can help perform larger-scale optimizations than those (peephole) optimizations available now.

Moreover, using an AST will eliminate the need for the clumsy MakeCStack procedure designed to deal with stdcall and cdecl functions.

Last but not least, it would probably help correctly compile expressions like a.f(x)^.b. Now it's a syntax error because the parser does not know when parsing f(x) whether its result is dereferenced (and so becomes a 'designator') or not (and so becomes a 'factor').

@vtereshkov vtereshkov added the enhancement New feature or request label Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant