source: trunk/src/gpu/lolfx-compiler.h @ 1590

Last change on this file since 1590 was 1590, checked in by sam, 7 years ago

core: start working on a higher level LolFx compiler based on the latest
GLSL grammar and some personal attempts at writing an HLSL grammar.

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#ifndef __LOLFX_COMPILER_H__
12#define __LOLFX_COMPILER_H__
13
14#include <string>
15
16#ifndef __FLEX_LEXER_H
17#   define yyFlexLexer LolFxFlexLexer
18#   include "FlexLexer.h"
19#   undef yyFlexLexer
20#endif
21
22#include "generated/lolfx-parser.h"
23
24class LolFx;
25
26namespace lol
27{
28
29class LolFxScanner : public LolFxFlexLexer
30{
31public:
32    LolFxScanner(char const *command);
33    virtual ~LolFxScanner();
34    virtual int LexerInput(char* buf, int max_size);
35    virtual LolFxParser::token_type lex(LolFxParser::semantic_type* yylval,
36                                        LolFxParser::location_type* yylloc);
37
38private:
39    char const *m_input;
40};
41
42class LolFxCompiler
43{
44public:
45    LolFxCompiler(class LolFx &lolfx);
46
47    bool ParseString(char const *command);
48
49    void Error(const class location& l, const std::string& m);
50    void Error(const std::string& m);
51
52    class LolFxScanner *m_lexer;
53    class LolFx &m_lolfx;
54};
55
56} /* namespace lol */
57
58#endif /* __LOLFX_COMPILER_H__ */
59
Note: See TracBrowser for help on using the repository browser.