+ 2
[Challenge] Lexical analyzer(any language c is preferable)
Take the input from the user and parse that and divide them into respective tokens For example a= 3; a - > variable = - > operator 3 - > constant
1 Odpowiedź
0
This would require a look-ahead parser capable of tokenizing the given language, a symbol table to hold the token->type relation and value, and more, along with a Reverse Polish Notation implementation for handling calculations and support for partial calculation with symbol table references for the RPN calculator so linking & compiling can work later.
It's pretty far beyond the scope of SoloLearn to make a C parser, but I've started working on a simple virtual machine for a simplified assembly language in JS and I'm considering making a simple high-level language on top of it which would include support for a full parser, linker, and compiler and be similar to basic JavaScript but with little to no interactivity with the webpage. It's only a simple, browser-based VM not meant for running directly on the hardware nor interacting with the OS though -- those additions are beyond the scope of both what I know how to do.
If you really want to make your own language that can run well on most hardware C# or Java may be able to help. Each has support for binding a scripting language to parts of it's API, or you can build your own parser/linker/compiler for their VM's bytecode interpreter.