Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (43 sloc) 1.472 kb
f66beca Bob Nystrom Starting to work on parser.
authored
1 #pragma once
2
0e2a7e1 Bob Nystrom Added :: syntactic sugar for binding methods to objects. Cleaned up exis...
authored
3 #include "Array.h"
f66beca Bob Nystrom Starting to work on parser.
authored
4 #include "Macros.h"
5 #include "Parser.h"
6 #include "Expr.h"
37c54fb Bob Nystrom Ref counted class. Parser now support keyword functions, (), and .
authored
7 #include "Ref.h"
0e2a7e1 Bob Nystrom Added :: syntactic sugar for binding methods to objects. Cleaned up exis...
authored
8 #include "String.h"
f66beca Bob Nystrom Starting to work on parser.
authored
9
10 namespace Finch
11 {
7248615 Bob Nystrom Made lexer and parser error-reporting more robust and display through th...
authored
12 class IErrorReporter;
9c31101 Bob Nystrom Multi-line REPL and better grammar.
authored
13 class ILineReader;
14
4f69b57 Bob Nystrom Cleaning up.
authored
15 // Parser for the Finch grammar.
998d526 Bob Nystrom Fixed infinite loop on parser error.
authored
16 class FinchParser : public Parser
f66beca Bob Nystrom Starting to work on parser.
authored
17 {
18 public:
7248615 Bob Nystrom Made lexer and parser error-reporting more robust and display through th...
authored
19 FinchParser(ITokenSource & tokens, IErrorReporter & errorReporter)
20 : Parser(tokens),
21 mErrorReporter(errorReporter)
9c31101 Bob Nystrom Multi-line REPL and better grammar.
authored
22 {}
f66beca Bob Nystrom Starting to work on parser.
authored
23
c88a81e Bob Nystrom More reorganization work to make Finch hostable.
authored
24 // Reads from the token source and returns the parsed expression. If
25 // this is an infinite source, it will return as soon as a complete
26 // expression is parsed. Otherwise, it will parse the entire source.
27 Ref<Expr> Parse();
9c31101 Bob Nystrom Multi-line REPL and better grammar.
authored
28
f66beca Bob Nystrom Starting to work on parser.
authored
29 private:
cc4936a Bob Nystrom Adding a sample file showing objects/prototypes. Documenting.
authored
30 // The grammar productions, from lowest to highest precedence.
37c54fb Bob Nystrom Ref counted class. Parser now support keyword functions, (), and .
authored
31 Ref<Expr> Expression();
32 Ref<Expr> Sequence();
0e2a7e1 Bob Nystrom Added :: syntactic sugar for binding methods to objects. Cleaned up exis...
authored
33 Ref<Expr> Bind();
e82d202 Bob Nystrom Bytecode for locals. Compiled BlockObjects.
authored
34 Ref<Expr> Assignment();
37c54fb Bob Nystrom Ref counted class. Parser now support keyword functions, (), and .
authored
35 Ref<Expr> Keyword();
36 Ref<Expr> Operator();
37 Ref<Expr> Unary();
38 Ref<Expr> Primary();
f66beca Bob Nystrom Starting to work on parser.
authored
39
015591d Bob Nystrom Array objects.
authored
40 void ParseSequence(Array<Ref<Expr> > & expressions);
41 Ref<Expr> ParseKeyword(Ref<Expr> object);
0e2a7e1 Bob Nystrom Added :: syntactic sugar for binding methods to objects. Cleaned up exis...
authored
42 Ref<Expr> ParseBindBody(Ref<Expr> target, String name,
43 const Array<String> & args);
dfc4e9f Bob Nystrom Nil keyword messages, if/then, while/do. String literals.
authored
44
37c54fb Bob Nystrom Ref counted class. Parser now support keyword functions, (), and .
authored
45 Ref<Expr> ParseError();
9c31101 Bob Nystrom Multi-line REPL and better grammar.
authored
46 Ref<Expr> ParseError(const char * message);
f66beca Bob Nystrom Starting to work on parser.
authored
47
7248615 Bob Nystrom Made lexer and parser error-reporting more robust and display through th...
authored
48 IErrorReporter & mErrorReporter;
49
5d1a751 Bob Nystrom Queue class. LL(2) parser. New <- syntax.
authored
50 NO_COPY(FinchParser);
f66beca Bob Nystrom Starting to work on parser.
authored
51 };
bfa447c Bob Nystrom Integrated makefile from Steve Forte. (Thanks!)
authored
52 }
53
Something went wrong with that request. Please try again.