User:Ans/lex and yac vm

From Wikiversity
Jump to: navigation, search
  • glade
    • save UI in xml
    • can convert xml to C code
      1. ui.xml --> ui.c
      2. callback.c + ui.c --> final application
    • has libglade that can load and run the xml on-the-fly, by not generating C code.
      • callback.c + libglade.so + ui.xml --> final application
      • no need to recompile ui.c, when ui.xml has been changed
      • libglade may be regarded as something like VM (virtual machine)
  • lex/yacc
    • write code in lex/yacc syntax
    • can generate C code
    • why not implement liblex/libyacc (lex/yacc VM) that can run on-the-fly, without generating C code?
      1. lex-parser.lex/yacc-parser.yacc --> lex-parser.xml/yacc-parser.xml
        • the xml file is something describing the state machine
        • the real benefit is the precompiled form?
        • need to change the callback without regenerate the state machine from the grammar rule, but the change should only be done in the rule source
        • yacc-parser.yacc --> yacc-parser-skeleton.yacc + callback.c
          • not overwrite and recompile yacc-parser-skeleton.yacc, if it unchanged
        • yacc-parser.yacc --> yacc-parser-skeleton.c + callback.c ?
          • this will regenerate the state machine before it has chance to cmp
      2. callback.c + liblex.so/libyacc.so + lex-parser.xml/yacc-parser.xml --> parser application