I am working on a shell, a small bash-like shell, without scripts (if for now ...) I need to do lexer / parser (LL) manually.
Thus, lexer converts the command ( char * cmd ) to a linked list ( t_list * list ). And the LL analyzer converts the linked list ( t_list * list ) to AST (binary tree t_btree * root ) with a grammar
So, I know how to make an LL parser, but I don't know how tokenize my command.
For instance: ps | grep ls >> file ; make && ./a.out
=> 'ps' '|' 'grep' 'ls' '>>' 'file' ';' ''make '&&' './a.out'
Thank.
(I do not want to use any generator)
source
share