Skip to content

Commit

Permalink
Renamed global let to def.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenHillyard committed Sep 26, 2023
1 parent 00b36ab commit fe5e972
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/commands/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::commands::Arguments;
use std::path::PathBuf;
use std::process::Command;

const TEST_SOURCE: &str = "let Nat = (A : Type) -> (A -> A) -> A -> A;
let pow = (n : Nat) => (m : Nat) => (
const TEST_SOURCE: &str = "def Nat = (A : Type) -> (A -> A) -> A -> A;
def pow = (n : Nat) => (m : Nat) => (
_ => n(_)(m(_))
) as Nat;
let three = (A => f => a => f(f(f(a)))) as Nat;
let nat_main = pow(three)(three);
def three = (A => f => a => f(f(f(a)))) as Nat;
def nat_main = pow(three)(three);
";

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ mod token {
Underscore,
#[token("as")]
As,
#[token("let")]
Let,
#[token("def")]
Define,
#[token("Type")]
Type,
#[regex("[a-zA-Z_][a-zA-Z_0-9]*")]
Expand Down
6 changes: 3 additions & 3 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod cst {
/// Represents the concrete syntax of a declaration.
#[derive(Debug)]
pub enum Declaration<'a> {
LetDeclaration {
Definition {
name: &'a str,
value: Expression<'a>,
},
Expand Down Expand Up @@ -152,10 +152,10 @@ mod grammar {
= expr()

rule decl() -> Declaration<'a>
= [Token::Let] [Token::Identifier(name)] [Token::Equals]
= [Token::Define] [Token::Identifier(name)] [Token::Equals]
value:expr() [Token::Semicolon]
{
Declaration::LetDeclaration {
Declaration::Definition {
name,
value
}
Expand Down
2 changes: 1 addition & 1 deletion src/typing/abstraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub fn abstract_file<'a>(file: &cst::File<'a>) -> Result<File<'a>, Vec<NameError
for decl in &file.declarations {
use cst::Declaration::*;
match decl {
LetDeclaration { name, value } => {
Definition { name, value } => {
let expr = match abstract_expression(&globals, &Names::Empty, value) {
Ok(expr) => expr,
Err(mut errs) => {
Expand Down

0 comments on commit fe5e972

Please sign in to comment.