[go: up one dir, main page]

Skip to content

onlyuser/XLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

XLang

Copyright (C) 2011-2017 mailto:onlyuser@gmail.com

About

XLang is a parser framework for language modeling.

It handles AST MVC, so as a language developer, you can focus on more important things, such as tuning the grammar.

A Motivating Example

input:

(-b+(b^2-4*a*c))/(2*a)

output:

picture alt

Usage

echo "(-b+(b^2-4*a*c))/(2*a)" | ./bin/XLang -d | dot -Tpng -oquadratic.png

Requirements

Unix tools and 3rd party components (accessible from $PATH):

gcc flex bison valgrind cppcheck doxygen graphviz ticpp

Environment variables:

  • $INCLUDE_PATH_EXTERN -- where "ticpp/ticpp.h" resides
  • $LIB_PATH_EXTERN -- where "libticppd.a" resides

Ubuntu packages:

  • sudo apt-get install flex
  • sudo apt-get install bison

Make Targets

target action
all make binaries
test all + run tests
pure test + use valgrind to check for memory leaks
dot test + generate .png graph for tests
lint use cppcheck to perform static analysis on .cpp files
doc use doxygen to generate documentation
xml test + generate .xml for tests
import test + use ticpp to serialize-to/deserialize-from xml
clean remove all intermediate files

References

"Tom Niemann Flex-Bison AST examples"
http://epaperpress.com/lexandyacc/
"Most vexing parse"
https://en.wikipedia.org/wiki/Most_vexing_parse
"Lexical Analysis With Flex - Start Conditions"
http://flex.sourceforge.net/manual/Start-Conditions.html
"Multiple Input Buffers"
http://flex.sourceforge.net/manual/Multiple-Input-Buffers.html
"Flex, A fast scanner generator - Actions"
http://dinosaur.compilertools.net/flex/flex_9.html

Keywords

Lex, Yacc, Flex, Bison, Parser, Reentrant, Abstract Syntax Tree, Model-View-Controller, Scott Meyer's "Most Vexing Parse", Multiple Input Buffers