├── .gitignore ├── Jamroot ├── fun ├── annotation.hpp ├── ast.hpp ├── ast_adapted.hpp ├── common.hpp ├── config.hpp ├── error_handler.hpp ├── expression.hpp ├── expression_def.hpp ├── interpreter.hpp └── printer.hpp ├── src ├── expression.cpp ├── interpreter.cpp └── printer.cpp └── test ├── Jamfile ├── eval_expression ├── expr1.expect ├── expr1.input ├── expr2.expect ├── expr2.input ├── expr3.expect ├── expr3.input ├── fun1.expect ├── fun1.input ├── number.expect ├── number.input ├── undefined_fun.expect ├── undefined_fun.input ├── wrong_arity.expect └── wrong_arity.input ├── eval_expression_test.cpp ├── parse_expression ├── bad_arguments.expect ├── bad_arguments.input ├── bad_expr1.expect ├── bad_expr1.input ├── bad_expr2.expect ├── bad_expr2.input ├── bad_group.expect ├── bad_group.input ├── bad_identifier.expect ├── bad_identifier.input ├── bad_nullary_function.expect ├── bad_nullary_function.input ├── function_call1.expect ├── function_call1.input ├── identifier.expect ├── identifier.input ├── number.expect ├── number.input ├── precedence1.expect ├── precedence1.input ├── precedence2.expect └── precedence2.input └── parse_expression_test.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | /bin/ 3 | -------------------------------------------------------------------------------- /Jamroot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/Jamroot -------------------------------------------------------------------------------- /fun/annotation.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/annotation.hpp -------------------------------------------------------------------------------- /fun/ast.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/ast.hpp -------------------------------------------------------------------------------- /fun/ast_adapted.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/ast_adapted.hpp -------------------------------------------------------------------------------- /fun/common.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/common.hpp -------------------------------------------------------------------------------- /fun/config.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/config.hpp -------------------------------------------------------------------------------- /fun/error_handler.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/error_handler.hpp -------------------------------------------------------------------------------- /fun/expression.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/expression.hpp -------------------------------------------------------------------------------- /fun/expression_def.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/expression_def.hpp -------------------------------------------------------------------------------- /fun/interpreter.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/interpreter.hpp -------------------------------------------------------------------------------- /fun/printer.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/fun/printer.hpp -------------------------------------------------------------------------------- /src/expression.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/src/expression.cpp -------------------------------------------------------------------------------- /src/interpreter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/src/interpreter.cpp -------------------------------------------------------------------------------- /src/printer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/src/printer.cpp -------------------------------------------------------------------------------- /test/Jamfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/Jamfile -------------------------------------------------------------------------------- /test/eval_expression/expr1.expect: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /test/eval_expression/expr1.input: -------------------------------------------------------------------------------- 1 | 1 + 2 + 3 -------------------------------------------------------------------------------- /test/eval_expression/expr2.expect: -------------------------------------------------------------------------------- 1 | 6.6 -------------------------------------------------------------------------------- /test/eval_expression/expr2.input: -------------------------------------------------------------------------------- 1 | 1.1 + 2.2 + 3.3 -------------------------------------------------------------------------------- /test/eval_expression/expr3.expect: -------------------------------------------------------------------------------- 1 | 456831 -------------------------------------------------------------------------------- /test/eval_expression/expr3.input: -------------------------------------------------------------------------------- 1 | (123 + 456) * 789 -------------------------------------------------------------------------------- /test/eval_expression/fun1.expect: -------------------------------------------------------------------------------- 1 | 0.707<%.*%> -------------------------------------------------------------------------------- /test/eval_expression/fun1.input: -------------------------------------------------------------------------------- 1 | sin(45 * (pi / 180)) -------------------------------------------------------------------------------- /test/eval_expression/number.expect: -------------------------------------------------------------------------------- 1 | 123.456 -------------------------------------------------------------------------------- /test/eval_expression/number.input: -------------------------------------------------------------------------------- 1 | 123.456 -------------------------------------------------------------------------------- /test/eval_expression/undefined_fun.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/eval_expression/undefined_fun.expect -------------------------------------------------------------------------------- /test/eval_expression/undefined_fun.input: -------------------------------------------------------------------------------- 1 | foo_bar(123) -------------------------------------------------------------------------------- /test/eval_expression/wrong_arity.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/eval_expression/wrong_arity.expect -------------------------------------------------------------------------------- /test/eval_expression/wrong_arity.input: -------------------------------------------------------------------------------- 1 | sin(1, 2) -------------------------------------------------------------------------------- /test/eval_expression_test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/eval_expression_test.cpp -------------------------------------------------------------------------------- /test/parse_expression/bad_arguments.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_arguments.expect -------------------------------------------------------------------------------- /test/parse_expression/bad_arguments.input: -------------------------------------------------------------------------------- 1 | foo(123, $%) -------------------------------------------------------------------------------- /test/parse_expression/bad_expr1.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_expr1.expect -------------------------------------------------------------------------------- /test/parse_expression/bad_expr1.input: -------------------------------------------------------------------------------- 1 | 123 + #$%^ -------------------------------------------------------------------------------- /test/parse_expression/bad_expr2.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_expr2.expect -------------------------------------------------------------------------------- /test/parse_expression/bad_expr2.input: -------------------------------------------------------------------------------- 1 | (123 + 456) * #$%^ + 9988 -------------------------------------------------------------------------------- /test/parse_expression/bad_group.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_group.expect -------------------------------------------------------------------------------- /test/parse_expression/bad_group.input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_group.input -------------------------------------------------------------------------------- /test/parse_expression/bad_identifier.expect: -------------------------------------------------------------------------------- 1 | Error! Expecting end of input here: $ * bar -------------------------------------------------------------------------------- /test/parse_expression/bad_identifier.input: -------------------------------------------------------------------------------- 1 | 123 + foo$ * bar -------------------------------------------------------------------------------- /test/parse_expression/bad_nullary_function.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/bad_nullary_function.expect -------------------------------------------------------------------------------- /test/parse_expression/bad_nullary_function.input: -------------------------------------------------------------------------------- 1 | foo() -------------------------------------------------------------------------------- /test/parse_expression/function_call1.expect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression/function_call1.expect -------------------------------------------------------------------------------- /test/parse_expression/function_call1.input: -------------------------------------------------------------------------------- 1 | foo(123, foo * bar, 1+2*3) -------------------------------------------------------------------------------- /test/parse_expression/identifier.expect: -------------------------------------------------------------------------------- 1 | (123 + (foo * bar)) -------------------------------------------------------------------------------- /test/parse_expression/identifier.input: -------------------------------------------------------------------------------- 1 | 123 + foo * bar -------------------------------------------------------------------------------- /test/parse_expression/number.expect: -------------------------------------------------------------------------------- 1 | 123.456 -------------------------------------------------------------------------------- /test/parse_expression/number.input: -------------------------------------------------------------------------------- 1 | 123.456 -------------------------------------------------------------------------------- /test/parse_expression/precedence1.expect: -------------------------------------------------------------------------------- 1 | (123 + (456 * 10)) -------------------------------------------------------------------------------- /test/parse_expression/precedence1.input: -------------------------------------------------------------------------------- 1 | 123 + 456 * 10 -------------------------------------------------------------------------------- /test/parse_expression/precedence2.expect: -------------------------------------------------------------------------------- 1 | (((123 + 456) / 10) + 5) -------------------------------------------------------------------------------- /test/parse_expression/precedence2.input: -------------------------------------------------------------------------------- 1 | (123 + 456) / 10 + 5 -------------------------------------------------------------------------------- /test/parse_expression_test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cierelabs/x3_fun/HEAD/test/parse_expression_test.cpp --------------------------------------------------------------------------------