Skip to content

Commit

Permalink
Add parsing for postulates (fix Toxaris#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaisorblade committed Feb 8, 2015
1 parent 5d34f40 commit 3d98ef5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src-lib/PTS/Syntax/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ stmt = withPos StmtPos $ asum
[ Export <$> (keyword "export" *> ident <* semi)
, Import <$> (keyword "import" *> modname <* semi)
, Assertion <$> (keyword "assert" *> expr) <*> optionMaybe (colon1 *> expr) <*> optionMaybe (assign *> expr) <* semi
-- we don't support argument telescopes for postulates -- yet!
, Bind <$> (keyword "postulate" *> ident) <*> pure [] <*> (colon1 *> (Just <$> expr)) <*> pure Nothing <* semi
, try (Term <$> expr <* semi)
, Bind <$> ident <*> telescope <*> optionMaybe (colon1 *> expr) <* assign <*> (Just <$> expr) <* semi]

Expand Down Expand Up @@ -168,7 +170,7 @@ pragma = lexem $ do
-- LEXER --
---------

keywords = ["Lambda", "lambda", "Pi", "if0", "then", "else", "->", "add", "mul", "sub", "div", "module", "import", "export", "assert", "language", "_("]
keywords = ["Lambda", "lambda", "Pi", "if0", "then", "else", "->", "add", "mul", "sub", "div", "module", "import", "export", "assert", "language", "postulate", "_("]

identChar x = not (isSpace x) && x `notElem` ".:=;/()[]$"

Expand Down

4 comments on commit 3d98ef5

@Toxaris
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also extend the lists of keywords for the emacs mode (near the top of emacs/pts-mode.el)?

@Blaisorblade
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I added a comment mentioning that: 2fa8f08

Could the emacs mode ask pts itself?

@Toxaris
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Yes, the emacs mode could ask PTS for the list of keywords. It already asks for the list of languages, so that code could be used as a template.

@Blaisorblade
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I earmarked this in Toxaris#140.

Please sign in to comment.