Implementation of compiler for a given subset of the php language into a wannabe assembly language, which is given in the assingnment.
The four main parts of the compiler:
- Lexical analysis
- Syntactic analysis
- Semantic analysis
- Code generator
Project for Formal languages and compilers class
License: Other
Implementation of compiler for a given subset of the php language into a wannabe assembly language, which is given in the assingnment.
The four main parts of the compiler:
DEFINE_VEC_FUNCTIONS_WITH_DESTRUCTOR in vec_resize control reaches end of a non-void function
src/vector.c: In function ‘vec_token_ptr_resize’:
src/headers/vector.h:320:1: error: control reaches end of non-void function [-Werror=return-type]
320 | }
| ^
src/vector.c:22:1: note: in expansion of macro ‘DEFINE_VEC_FUNCTIONS_WITH_DESTRUCTOR’
22 | DEFINE_VEC_FUNCTIONS_WITH_DESTRUCTOR(token_ptr, token_ptr, free);
Funkcia vec_push_back pri pushnuti prveho prvku ulozi prvok na index 1 nie nula co neviem ci je bug alebo to tak ma bit
Pri volani funkcie new_vec_with_capacity(n) sa do premenej capacity_ ulozi sizeof(type)*n ( sizeof(type) moze bit vecsi nez 1 ).
https://github.com/stolo93/IFJ_2022/blob/314fa6acaf2f8f286ca7dd04911d80b46b76fa2e/src/headers/vector.h#L54
https://github.com/stolo93/IFJ_2022/blob/314fa6acaf2f8f286ca7dd04911d80b46b76fa2e/src/headers/vector.h#L168
Cize sa do kapacity ulozi velkost alokovaneho priestoru v pamati miesto max poctu prvkov na ulozenie co by sa tam asi malo ukladat.
Tim padom podmienka vo funkcii vec_push_front nema zmysel:
https://github.com/stolo93/IFJ_2022/blob/314fa6acaf2f8f286ca7dd04911d80b46b76fa2e/src/headers/vector.h#L97
lebo ak len_ bude max pocet prvkov kolko mozem ulozit do pola tak to bude vzdy mensie nez alokovany priestor (jedine ak robime s datovim typom char tak by to fungovalo, neskusal som). Dalej ked je tato funkcia volana prvi krat tak len_ bude nula pri volani:
https://github.com/stolo93/IFJ_2022/blob/314fa6acaf2f8f286ca7dd04911d80b46b76fa2e/src/headers/vector.h#L43
cize nastane (size_t)0-1 co podtecie a for loop segfaultne.
In CONTRIBUTING.md we mention the --force flag we should instead mention --force-with-lease.
Details:
If the interner already has at least one string in it then interning a string which should be placed at the end of the backing array when sorting with strcmp, the intern function will produce a pointer one past the end of the backing array and then attempt to use it in a strcmp function. strcmp will then attempt to de-reference this pointer and if we're lucky segfault.
print_err_info uses printf instead of fprintf.
htab.c should either be placed in the src file or path to this file has to be given to Makefile explicitly in VPATH variable (I may not be correct about this).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.