File: shunting-yard.h

package info (click to toggle)
bitwise 0.50-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 628 kB
  • sloc: sh: 4,449; ansic: 2,234; makefile: 31
file content (28 lines) | stat: -rw-r--r-- 668 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2011 - 2012, 2014 Brian Marshall. All rights reserved.
//
// Use of this source code is governed by the BSD 2-Clause License that can be
// found in the LICENSE file.

#include <stdint.h>

#ifndef SHUNTING_YARD_H
#define SHUNTING_YARD_H

typedef enum {
	STATUS_OK,
	ERROR_SYNTAX,
	ERROR_OPEN_PARENTHESIS,
	ERROR_CLOSE_PARENTHESIS,
	ERROR_UNRECOGNIZED,
	ERROR_NO_INPUT,
	ERROR_UNDEFINED_FUNCTION,
	ERROR_FUNCTION_ARGUMENTS,
	ERROR_UNDEFINED_CONSTANT,
	ERROR_WRONG_ARGUMENTS,
	ERROR_DIVIDE_BY_ZERO,
} Status;

// Calculates the result of a mathematical expression.
Status shunting_yard(const char *expression, uint64_t *result);

#endif  // SHUNTING_YARD_H