From: Lukas Jiriste Date: Fri, 14 Jun 2024 10:36:31 +0000 (+0200) Subject: Add description of the format of parsing table X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=74c44772732563517c83747d261d391ae9dd1de0;p=Libft.git Add description of the format of parsing table --- diff --git a/inc/ft_parse.h b/inc/ft_parse.h index d34bd6a..4c579da 100644 --- a/inc/ft_parse.h +++ b/inc/ft_parse.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/27 21:21:54 by ljiriste #+# #+# */ -/* Updated: 2024/05/27 22:57:11 by ljiriste ### ########.fr */ +/* Updated: 2024/06/14 11:20:28 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,10 +39,30 @@ typedef struct s_parser_state t_vec gotos; // t_vec of size_t } t_parser_state; +// The states table has the following form: +// +// State token[i] token[i+n] +// j states[j].lookahead[i] states[0].goto[i] +// +// The whitespace is not significant and ; should be used as separator +// +// The first row contains all the n terminal tokens first +// and after them all the non-terminal tokens. +// Every other row contains the (unique) state number and the reduce/shift +// rule for the appropriate token. +// +// The rules table should have the form +// +// token[i_1] -> [ token[j_1] [ token[k_1] ... ]] +// token[i_2] -> [ token[j_2] [ token[k_2] ... ]] +// +// Tokens should not contain whitespace as it is used as separator + typedef struct s_parsing_table { t_vec rules; // t_vec of t_grammar_rule t_vec states; // t_vec of t_parser_state + t_vec tokens; // t_vec of tokens } t_parsing_table; #endif // FT_PARSE_H